So basically I want to type something into a textbox and have that automatically run a query in my listbox for like values.
This is the code I'm using.
txtProperty = Text box
lstSearchResults = List Box
Table = Table
This code doesn't work. Whenever I try, nothing happens. I remember I've done this in the past and there's a trick to it, but I don't recall what that trick was. Anyone have any ideas what I'm missing?
This is the code I'm using.
txtProperty = Text box
lstSearchResults = List Box
Table = Table
Code:
Private Sub txtProperty_Change()
On Error GoTo Err_txtProperty_Change
Dim strSource As String
strSource = "SELECT ID, List " & _
"FROM Table " & _
"Where ID Like '*" & Me.txtProperty.Text & "*' " _
Me.lstSearchResults.RowSource = strSource
Exit_txtProperty_Change:
Exit Sub
Err_txtProperty_Change:
MsgBox Err.Number & " " & Err.Description
Resume Exit_txtProperty_Change
End Sub
This code doesn't work. Whenever I try, nothing happens. I remember I've done this in the past and there's a trick to it, but I don't recall what that trick was. Anyone have any ideas what I'm missing?