Access VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I open my form I want my combo box to drop down and show the records
somewhat like a list box.
VBA code?
 
vbalearner said:
When I open my form I want my combo box
to drop down and show the records
somewhat like a list box.

A Combo Box's list can be dropped down only when it has the focus. So, if
you want to do this on opening the form, that will be the Control with the
focus, and the user must edit/update it first. If the user moves the cursor
to another Control, the dropdown list will close.
VBA code?

Me.<nameofyourcombobox>.SetFocus
Me.<nameofyourcombobox>.Dropdown

in the OnCurrent Event of the Form.

Perhaps more useful, in the OnEnter event of your Combo Box, put

Me.<nameofyourcombobox>.Dropdown

so the list will be dropped down when the user enters that box by tabbing to
it, or by clicking on it.

However, usually Combo Boxes have their AutoExpand property set to Yes, and
the user may expect to enter and start typing to have it scroll to the
nearest match, and may or may not desire the list to be displayed. If you
are not the only user, it would be good to determine what the users want.

Larry Linson
Microsoft Access MVP
 
thanks that works great

Larry Linson said:
A Combo Box's list can be dropped down only when it has the focus. So, if
you want to do this on opening the form, that will be the Control with the
focus, and the user must edit/update it first. If the user moves the cursor
to another Control, the dropdown list will close.


Me.<nameofyourcombobox>.SetFocus
Me.<nameofyourcombobox>.Dropdown

in the OnCurrent Event of the Form.

Perhaps more useful, in the OnEnter event of your Combo Box, put

Me.<nameofyourcombobox>.Dropdown

so the list will be dropped down when the user enters that box by tabbing to
it, or by clicking on it.

However, usually Combo Boxes have their AutoExpand property set to Yes, and
the user may expect to enter and start typing to have it scroll to the
nearest match, and may or may not desire the list to be displayed. If you
are not the only user, it would be good to determine what the users want.

Larry Linson
Microsoft Access MVP
 
Back
Top