chestera
asked on
List box like search
Hi EE
I have the following code that will do a search in a list box
intnum = Me!txtDescrip
Me!lstPart.SetFocus
With Me!lstPart
For i = 0 To .ListCount - 1
If .Column(2, i) Like intnum Then
.Selected(i) = True
Flag = True
Exit For
End If
Next i
End With
although it has a like statement it will only pick up a name for example if the name search is in full ie Smith. I would like to modify or another methode to do a search by one or two characters ie search by S or Sm and it will pick up all names beginning with Sm. I know we can do this with combo box but in this instance I would like a list box. Any help appreciated
chestera
I have the following code that will do a search in a list box
intnum = Me!txtDescrip
Me!lstPart.SetFocus
With Me!lstPart
For i = 0 To .ListCount - 1
If .Column(2, i) Like intnum Then
.Selected(i) = True
Flag = True
Exit For
End If
Next i
End With
although it has a like statement it will only pick up a name for example if the name search is in full ie Smith. I would like to modify or another methode to do a search by one or two characters ie search by S or Sm and it will pick up all names beginning with Sm. I know we can do this with combo box but in this instance I would like a list box. Any help appreciated
chestera
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
IrogSinta
That was a bad example I used that particular code for numerical searches. Thank you for that information
Alan
That was a bad example I used that particular code for numerical searches. Thank you for that information
Alan
ASKER
capricorn1
Many thanks
Alan
Many thanks
Alan
private sub txtSearch_change()
dim str as string
str=str & me.txtsearch.text
me.listbox.rowsource="sele
end sub