Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox and Item Selection

Status
Not open for further replies.

joatmofn

Technical User
Jan 12, 2003
72
US
My listbox jumps to an item that begins with the letter of the key typed, e.g., press the "b" key and the first item that begins with a "b" is selected. Type in a 2nd letter, such as "e" and the item selected is the first item that begins with "e".

I want to spell a word and have the item jump to that word, e.g, type be and select the item that begins with the letters be. Much the way a combobox works.

Is there a property to set? I looked, but didn't find it. Thanks for any tips on this one.

 
Only the ComboBox object expose the AutoExpand property.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 

You can manually create this functionality for a listbox if you use a separate text box for entering the text.

In the OnChange event of the text box, use the following code, substituting your own text box and listbox names:

Code:
If Not IsNull(Me!txtSearch.Text) And Me!txtSearch.Text <> "" Then
    lstBox.Requery
End If


Use a query for your listbox RowSource and use criteria in the following format to filter the listbox as you type.

Code:
Like [Forms]![frmMyForm]![txtSearch].[text] & "*"

If I haven't left anything out, it should work just like the combo box AutoExpand.

This would mostly be used in a case where the customer wants to retain the listbox view and multi-select feature, but with AutoExpand functionality.

Mike Dorthick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top