[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1014
  • Last Modified:

Requery in On GotFocus event of combo box dropdown appears then disappears

I have created a number of combo boxes that need to be refreshed when the user selects them as their rowsource is dependent on the contents of other fields. I have created an On GotFocus event that contains the command me.CboMyBox.requery. If I move from another field on the form to the combo box, the requery runs, the dropdown appears with the new list momentarily then disappears. If I then click on the dropdown again it works fine. Can anyone help me resolve this issue? I am using MS Access 2007
0
Rob4077
Asked:
Rob4077
  • 5
  • 4
  • 2
6 Solutions
 
carazuulCommented:
Hi Rob4077,
Try adding Me.CboMyBox.DropDown after you requery. Should make the list reappear.
Regards,
carazuul
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
For starters, it *should* not drop down on the Got Focus and Requery.

Also, using DropDown ... can be REALLY annoying to users - if there are just 'tabbing through' controls (combos in particular) ... if they are not planning on 'stopping' in that combo.

mx
0
 
Rob4077Author Commented:
Nor sure that the answer is clear as to why this is happening or how to fix. What my users are doing is going from one field directly to the dropdown arrow on this field and they have to press it twice to get it to appear. Is the Me.CboMyBox.DropDown solution the best for me to use?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
carazuulCommented:
If you're requerying when they click on the dropdown it will cause it to hide again. Using Me.CboMyBox.DropDown will end up with it showing again after the requery, so it should behave as they expect.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
"directly to the dropdown arrow on this field and they have to press it twice to get it to appear"

Normally ... that is exactly what would happen if ... you have
Me.ComboName.DropDown  in the On Enter or Got Focus.

"If you're requerying when they click on the dropdown it will cause it to hide again. "

I don't  think that is the case.  I just set up a combo with a 150 or so items - and a Requery in the Got Focus.  When I click the dropdown directly from somewhere else, the list drops down and stays down.  I briefly see the hourglass - a result of the Requery.

mx
0
 
Rob4077Author Commented:
Thanks for all your comments.
I remain confused by this one. What you say about the combo box working as hoped after the requery, mx, is what I have happen with many other applications where I use the same code. However on this one, and a few others, it behaves as carazuul explains it should. I don't understand this at all.
Anyway I will try the .dropdown method and see if that works as soon as I get access to the network again and confirm it works in my application. I agree with mx that it may be annoying in some instances but I think it may prove to be the best option.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
", it behaves as carazuul explains it should."
Except that is should not work this way.

"in some instances but I think it may prove to be the best option."
It's really not good UI design.

Can you temporarily convert this back to A2003 and upload - explaining how to duplicate the problem ?

mx
0
 
Rob4077Author Commented:
Sorry for the delay in responding. I was hoping to have the time to convert to 2003 and post last night but didn't.
As a short term fix I tried this morning putting in the .dropdown after the .requery and it made no difference. This seems to imply that some other code is running after the .requery and the .dropdown doesn't it? I have tried stepping through the code but there doesn't appear to be anything else happening. Does this help identify the problem?
I will try to re-create the problem in a small 2003 database as soon as I can.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Really need to see an A2003 version ....

mx
0
 
Rob4077Author Commented:
Ok will try to re-create today.
0
 
Rob4077Author Commented:
I started to re-build and couldn't re-create the problem so I decided to just rebuild the control (dropdown). It works fine now. Must have been a corruption somewhere. Sorry I wasted so much of my time and even more sorry that I wasted yours. Thanks for all your help. Will apportion points as fairly as I can on the basis that your inputs led me to the conclusion. Thanks again.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 5
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now