making a combo box open when the first letter is typed

  • Thread starter Thread starter Paul James
  • Start date Start date
P

Paul James

Is there a way to get a combo box to pop open as soon as the user types the
first letter from the keyboard?

My reason for wanting this is that the Row Source for this combo box has
almost 2,000 records, and while the values in the (0" width, VendorID) bound
control are unique, the values in the column the user is seeing, and typing,
aren't. The reason for this is that the user is typing values into the 2"
width Vendor column, but some of these Vendors appear in more than one
record, when a Vendor has more than one address. So if the user doesn't at
least get a visual cue that there are more than one of these Vendors, along
with a display of their addresses in the adjacent column, they might select
the first Vendor that the auto complete feature of the combo box leads them
to. But that will not necessarily be the one they want. Hence, my thinking
the best way to deal with this is to have the combo box pop open as soon as
they type the first letter, so they can at least see the other record(s) for
that vendor right below the currently-highlighted rows.

If there's a better approach to handling this, please tell me. Otherwise,
how can I get the combo box pop open as soon as the first letter is typed?

Thanks in advance to all you kind folks out there who answer these
questions.

Paul
 
You could use the OnChange event of the combo box to drop down the combo
box's list:

Private Sub cboBoxName_Change()
Me.cboBoxName.DropDown
End Sub

Note that this code will run each time a letter is typed. Perhaps it would
be better to dropdown the list as soon as the combo box gets the focus:

Private Sub cboBoxName_GotFocus()
Me.cboBoxName.DropDown
End Sub
 
Works great. Thanks, Ken.

Actually, I'm probably going to use the Change event since the overhead is
only a few nanoseconds. Having the box drop down when you merely tab into
it can be visually obtrusive.

Paul
 
Back
Top