combo dropdown from code behaves weirdly

K

Kate

I'm using Access 2003, and it's got some strange behaviors. When I
programatically set the focus to a combo box, then tell it to dropdown
(when the form opens), the drop box floats below the combo box about
1/2" below the control!! If I make it drop down by simply clicking the
combo box, it is attached correctly to the control. Anyone have any
idea on how to fix this 'feature?'

Thanks,
Laurel
 
B

Brendan Reynolds

It's a timing issue, and not unique to Access 2003, I've seen it in earlier
versions as well. When you open and close forms, the menu and toolbars that
are displayed change, and the position of the form on the screen is adjusted
accordingly. If the form is slow to open, the list drops down before the
form's position is adjusted. When the form's position is adjusted, the
dropped-down list stays where it was.

As it only happens when the form is slow to load, you might be able to solve
the problem by optimizing the form. Failing that, I have on occasion had to
resort to using a form's Timer event procedure. In design view, I set the
TimerInterval property to 0, then in the form's Activate event procedure I
set the TimerInterval property to a suitable value, e.g. 250 (a quarter of a
second). You're now guaranteed that the code in the Timer event procedure
will not run until a quarter of a second after the form was activated. If
you only want the code to run once each time the form is activated, set the
TimerInterval back to 0 at the end of the Timer event procedure.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
K

Kate

Thank you, Brendan, for that explanation! I thought I was going nuts.
It's great to not only understand 'weird' behavior, but also have an
idea how to solve it!

Kate
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top