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
LVL 1
Rob4077Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

carazuulCommented:
Hi Rob4077,
Try adding Me.CboMyBox.DropDown after you requery. Should make the list reappear.
Regards,
carazuul
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
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
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
"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 Access MVP)Database Architect / Systems AnalystCommented:
", 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 Access MVP)Database Architect / Systems AnalystCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.