Jeff

  • Thread starter Thread starter How to find a specific value in a listbox using a
  • Start date Start date
H

How to find a specific value in a listbox using a

I have a listbox that is getting its information from a
table. What I want to do is have a textbox that will
allow me to start typing and the listbox will start
selecting the values that I will be typing. So what I
want is to look through the values of the list box and
select the one that closest matches the criteria. For
Example. I have a list box with first and last name. I
want to search for someone by lastname. I am looking for
clark. I type C in the a textbox, then the listbox will
select the first line with a c in it. Then when I type L
the listbox should jump to the first cl line that exists.
I hope this is clear. Thanks for your help.

Jeff
 
In the properties for your listbox, click the "data" tab.
Change "Auto Expand" to Yes.

~ Kathryn
 
A list box doe NOT have an auto expand property.
If you sort the List box by the last name field, you will get
all shown in proper sorted order.
Type the first letter in the name and the list will jump to
the first name that starts with that letter.
But you will not be able to continue typing one letter at a time and
have it work the way a combo box does.

Use a Combo Box.
Sort it on the LastName field.
If you wish to see more than one record at a time,
set the combo box to drop down automatically on entering the field.

Private Sub ComboName_Enter()
Me.ComboName.Dropdown
End Sub

Now, when you start typing, you can add a letter at a time and the list will
follow.
 
Back
Top