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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access

Status
Not open for further replies.

5bhaya

Technical User
Jul 30, 2002
11
0
0
CA
I have a listbox that has two columns: EmployeeID and FullName (which is an employee full name). I have a textbox and what I would like to accomplish is that when a user types a letter in the textbox, the item in the list box (EmployeeID is a boundcolumn for the listbox )should be highlighted based on this input in the textbox. I have a code in the keypress_event of the textbox which passses on the letter typed to the procedure. The idea is to compare this string to each name in the listbox in a loop and if both strings are equal, to highlight the item in a listbox. The problem is I cannot find a property in the listbox that could give me the employee name (e.g. combo box has a list property)in iteration. Any idea/help shall be appreciated.
 
Hi!

In the textbox's change event you can use the following code:

Dim intRow As Integer

For intRow = 0 To Me!YourListBox.ListCount - 1
If Me!YourListBox.Columns(1, intRow) Like Me!YourTextBox.Text & "*" Then
Me!YourListBox.Selected(intRow) = True
Exit For
End If
Next intRow

hth
Jeff Bridgham
bridgham@purdue.edu
 
Thanks! It worked great. While it highlighted the name in
the list box still I had to select the highlighted item and thereafter click the button to view the selected name's detail form. So I reviewed Q218621 from Microsoft Knowledge base article and it served the purpose.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top