I have a listbox that updates its records when a textbox on the form is changed.
Code:
Private Sub ClientSearch_Change()
Dim sql As String
'if you want to match any part of the string then add wildcard (*) before the FilterBy.Text, too:
sql = "SELECT ClientNameList, ClientName FROM ClientList WHERE ClientName Like '*" & Me.ClientSearch.Text & "*' ORDER BY ClientName"
Me.ClientNameList.RowSource = sql
End Sub
Private Sub ClientSearch_Click()
Me.ClientSearch = ""
Me.ClientSearch.FontItalic = False
End Sub
Private Sub Form_Load()
Me.ClientSearch = "Search..."
Me.ClientSearch.FontItalic = True
End Sub
I have also have a subform that updates to the selected client from the listbox. This works fine up until I narrow down the listbox with the above code. Once I narrow the list down, when I select a record in the listbox to display in the subform, it doesn't update the subform at all.
On the subform, the Masterlink field is ClientNameList and the Childlink field is ClientID