Combobox

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

Guest

When my form is opened I have a combobox populated with a list of employees
from a select query in the row source (basic stuff) but by default the
combobox appears empty until you select the arrow. My question is how do I
make the first employee name show up in the list without having to select one.

mega thanks
 
My idea is when your combobox got focus, you run combobox.dropdown and then
sendkeys <down arrows> to simulate what we always do to select the first row
in list. Don't forget to use On Error Resume Next before any above code to
prevent any error may have.

HTH,
Suntisuk
 
cghall55 said:
When my form is opened I have a combobox populated with a list of employees
from a select query in the row source (basic stuff) but by default the
combobox appears empty until you select the arrow. My question is how do I
make the first employee name show up in the list without having to select one.


Not clear what situation this is for. If the combo box is
bound to a field in the form's record source table/query and
you want new records to default to the first item in the
list, then set the DefaultValue property to:
=Combo0.ItemData(0)

If the combo box is not bound, then you can use code in the
form's Load event procedure to set its value:

Me.Combo0 = Me.Combo0.ItemData(0)
 
Back
Top