Asked by:
Two clicks needed to make drop-downs work.

Question
-
I have a form that requires you to click the drop-down twice to get it to drop-down. I examined the code and there is an 'on got focus' event that does a <control>.dropdown. This works well when you tab from field to field but it has the undesirable side-effect of causing this problem. I commented out this event and then the drop-down needs just a single click but I then lose the auto-dropdown effect when tabbing. Is there any way to get both things to work?
Update:
Actually, it's the down arrow you have to click twice. If you click once in the entry field, it does work ok.- Edited by AllTheGoodNamesWereTaken Friday, December 11, 2015 1:22 AM
Thursday, December 10, 2015 1:51 AM
All replies
-
Hi Allthe,
What is your drop-down, is it a combobox control in a form? What is your Access version? I add a combobox to a form, add “Combo43_GotFocus” event, then made a test with tab and click, it worked correctly at my side. I only need to click once. With my test under Access 2013 desktop database, is there any difference between yours?
>>it's the down arrow you have to click twice. If you click once in the entry field, it does work ok
In my option, if you click in the entry field, the GotFocus event would fire, and then make it drop down.
I suggest you create a new form with simple combobox to check whether this issue still exist.
Best Regards,
Edward
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Proposed as answer by Edward8520Microsoft contingent staff Monday, December 21, 2015 8:47 AM
- Unproposed as answer by AllTheGoodNamesWereTaken Tuesday, January 5, 2016 10:00 PM
Friday, December 11, 2015 1:52 AM -
Update:
Actually, it's the down arrow you have to click twice. If you click once in the entry field, it does work ok.- Proposed as answer by Edward8520Microsoft contingent staff Monday, December 21, 2015 8:47 AM
- Unproposed as answer by AllTheGoodNamesWereTaken Tuesday, January 5, 2016 10:01 PM
Friday, December 11, 2015 2:32 AM -
I have a form that requires you to click the drop-down twice to get it to drop-down. I examined the code and there is an 'on got focus' event that does a <control>.dropdown. This works well when you tab from field to field but it has the undesirable side-effect of causing this problem. I commented out this event and then the drop-down needs just a single click but I then lose the auto-dropdown effect when tabbing. Is there any way to get both things to work?
Hi ATGNWT,
What I have observed, is that in a control with the text selected, the first click is to de-select the text, the next click is to do the movement to an other control.
Imb.
Friday, December 11, 2015 6:51 AM -
I'm curious as to what version of Access you're using? I've worked with all version back to 2.0 and I've never seen this behavior. I just tested in 2003, 2007 and 2010 environments and all worked fine. Edward Z states that he's tested the same on 2013 and doesn't see this behavior either. In my testing I tried both the OnEnter and GotFocus events. Both tests were successful in each environment mentioned.
- Proposed as answer by Edward8520Microsoft contingent staff Monday, December 21, 2015 8:47 AM
- Unproposed as answer by AllTheGoodNamesWereTaken Tuesday, January 5, 2016 9:39 PM
Friday, December 11, 2015 7:39 AM -
I do exactly the same in my personal accounts database, and don't experience the behaviour you describe. What is the exact code used in the GotFocus event procedure? And are there any other event procedures associated with the control whose code might be influencing the behaviour?
The fact that the value is being deselected suggests that there might be additional code which does this, e.g. by setting the controls SelLength and SelStart properties. If so, that is the probable culprit. Such code would, if anything, be counter-productive in a combo box, as any value typed in would be added to the start or end of the current value, rather than replacing it, and would negate the control's autoexpand mechanismKen Sheridan, Stafford, England
- Proposed as answer by Edward8520Microsoft contingent staff Monday, December 21, 2015 8:47 AM
- Unproposed as answer by AllTheGoodNamesWereTaken Tuesday, January 5, 2016 9:39 PM
Friday, December 11, 2015 7:01 PM -
Sorry for delay in replying but I got diverted onto other things.
I'm using:
Here are the 2 events for this control, I don't believe the LostFocus event is a factor as I get similar results with controls without this event:
Private Sub Program_GotFocus()
Me!Program.Dropdown
End SubPrivate Sub Program_LostFocus()
If Program = "Q1Q2" Then
SentTo = "DMS"
DateSentbyResearch = Date
End If
End SubRowsource is SELECT PayGroup FROM tblPayGroups ORDER BY PayGroup
The results are inconsistent, but If I click in some other control (a text box), then click the down arrow, nothing happens, then if I click the down arrow again I get the drop down. If I click in the entry area of the combo box, I do get the drop down. When the 'on got focus' event is removed, it works properly but then I don't get the drop-down when tabbing.
Tuesday, January 5, 2016 9:59 PM -
I can't reproduce the behaviour you are experiencing. In my case the lists drops down both when the control receives focus and when its arrow is clicked. The only difference is that in my case I use the generic code:
Me.ActiveControl.Dropdown
rather than referencing the control by name, but changing it to the latter does not affect the behaviour.Ken Sheridan, Stafford, England
Tuesday, January 5, 2016 11:13 PM -
When I click in the other text box, it moves the focus to the other control. Then when I move to the combo box and click the down arrow, there is no drop-down but the cursor appears inside the empty combo box. So it looks like clicking the down-arrow does not cause the drop-down unless the control already has the focus.
As I said this only happens when I have an 'on got focus' event for the combo box, otherwise it works fine.
One thing I omitted to mention, which may be a factor. All these controls are on one tab of a tab control.
Wednesday, January 6, 2016 12:00 AM -
Sorry, but I can't fix what ain't broke in my case.
Ken Sheridan, Stafford, England
Wednesday, January 6, 2016 12:12 AM -
Hi AllTheGoodNames,
I could reproduce your issue with a combobox in a tab control.
For a workaround, I suggest you create a combobox control in a Blank Form with the code below. And then drag and drop the Blank Form to the tab control.
Private Sub Combo18_GotFocus() Me.Combo18.Dropdown End Sub
Best Regards,
Edward
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.Wednesday, January 6, 2016 6:01 AM