Form/Combo-box behavior

G

Guest

Windows XP, MS Access 2000
=======================

I have an Access database with the following options NOT checked off in
Startup Options:

1. Allow Full Menus
2. Allow Built-in Toolbars
3. Display Database Window
4. Use Access Special Keys

I have an unbound control (combo-box) on the form, and the following code in
the Got Focus property of the combo-box:
==================================
If IsNull(Me.cboProgramID_frmMenu_2) Then
Me.cboProgramID_frmMenu_2.Dropdown
End If
==================================

This form is used to select an option using the combo-box and then the user
clicks on a button (there are 6 buttons) to open other forms. What I'm trying
to achieve is to have the drop-down menu already displayed when the form
opens, instead of the user activating the drop-down menu.

Because I don't display the standard toolbar, what happens is that the form
opens, and the combo-box options are displayed, BUT there is a gap between
the combo-box and the displayed menu, as the form "adjusts" to not displaying
the toolbar.

Is there a way to fix this so that the gap between the combo-box and the
drop-down menu is eliminated, and the drop-down menu is displayed in a
"normal" manner?

Thanks!

-Amit
 
M

Marshall Barton

Amit said:
Windows XP, MS Access 2000
=======================

I have an Access database with the following options NOT checked off in
Startup Options:

1. Allow Full Menus
2. Allow Built-in Toolbars
3. Display Database Window
4. Use Access Special Keys

I have an unbound control (combo-box) on the form, and the following code in
the Got Focus property of the combo-box:
==================================
If IsNull(Me.cboProgramID_frmMenu_2) Then
Me.cboProgramID_frmMenu_2.Dropdown
End If
==================================

This form is used to select an option using the combo-box and then the user
clicks on a button (there are 6 buttons) to open other forms. What I'm trying
to achieve is to have the drop-down menu already displayed when the form
opens, instead of the user activating the drop-down menu.

Because I don't display the standard toolbar, what happens is that the form
opens, and the combo-box options are displayed, BUT there is a gap between
the combo-box and the displayed menu, as the form "adjusts" to not displaying
the toolbar.

Is there a way to fix this so that the gap between the combo-box and the
drop-down menu is eliminated, and the drop-down menu is displayed in a
"normal" manner?


That's pretty weird. I've never seen that happen so the
only things I can think of to try are adding a DoEvents
before the .DropDown and/or a Me.Repaint after the
..DropDown. Yuch!
 
G

Guest

That's pretty weird. I've never seen that happen so the
only things I can think of to try are adding a DoEvents
before the .DropDown and/or a Me.Repaint after the
..DropDown. Yuch!

Hi Marshall,

I tried Repaint, and it didn't accomplish the desired result. It seems like
the DropDown event happens before the Toolbars are removed, and when the
form moves up, the drop-down menu doesn't move with the form. I also have a
DoCmd.Maximize in the FormOpen, and I tried the form without that statement
with the same result.

I added a DoEvents before the "If" statement , and it worked!! Now the
drop-down menu opens with no space between it and the combo-box. I read the
DoEvents in the Help section, but I'm still not sure how/why it works. If
you can explain it in your words, that'll be helpful, as I'd like to
understand the mechanism.

Thanks!

-Amit
 
M

Marshall Barton

Amit said:
Amit said:
I tried Repaint, and it didn't accomplish the desired result. It seems like
the DropDown event happens before the Toolbars are removed, and when the
form moves up, the drop-down menu doesn't move with the form. I also have a
DoCmd.Maximize in the FormOpen, and I tried the form without that statement
with the same result.

I added a DoEvents before the "If" statement , and it worked!! Now the
drop-down menu opens with no space between it and the combo-box. I read the
DoEvents in the Help section, but I'm still not sure how/why it works. If
you can explain it in your words, that'll be helpful, as I'd like to
understand the mechanism.


Windows is a time sliced multitasking system and Access
starts additional tasks when it thinks it has multiple
(semi?) independent activities to perform. DoEvents is a
way for your code execution task to give up its time slice
to other tasks (in this case redrawing the Access window
without the tool bar). There is no way to "know" if
DoEvents will be sufficient since the other tasks may take
several time slices to complete or the task you want to
finish its work may depend on the completion of yet one or
more other tasks.
 

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