i have a text box for search and a button to change the row source for a list box
when i put something in the text box and click search button it works and do the filter for me,
so i copied the on click event codes to the on change event of the text box and im expecting to do the filter same as i click on the search button . but it does not
why is that please??
Code: Select all
Private Sub txtSearch_Change()
On Error GoTo Err_txtProperty_Change
Dim sql As String
sql = "Select Products.[Product Code], Products.[Product Name] from products" _
& " Where [Product Code] like '*" & Me.txtSearch & "*'"
Me.CustomerList.Form.RecordSource = sql
Me.CustomerList.Form.Requery
Me.lstCustomer.RowSource = sql
Me.lstCustomer.Requery
Err_txtProperty_Change:
End Sub