Scroll a list box

arvindn

Registered User.
Local time
Today, 21:44
Joined
Oct 1, 2003
Messages
99
My problem is this :-

I have a text box and a list box in a form.

When the user types in something in the text-box i want the closest matching record (based on the first column) of the list box to be scrolled to.

For eg.

Text in Text box is Kan

Then the list box should scroll to records starting with Kan.

I am currently achieveing this using Sendkeys as i have rarely used list boxes but would prefer a cleaner method if possible.
 
arvindn,

Just doing this off the cuff, so the syntax might not be right.

Use the AfterUpdate event of the TextBox:

Code:
Dim i As Long
For i = 0 to YourListBox.ListCount - 1
   If Me.YourListBox.ItemData(i) Like Me.TextBox & "*" Then
      Me.YourListBox.Selected(i) = True
   Next i

Wayne
 
Thanks , will try it out and let u know.
 
Thanks Wyan, but i was unable to solve my purpose when i changed the listbox's rowsource type to Table/Query and populated it with a table having 4000 records.
 

Users who are viewing this thread

Back
Top Bottom