Private Sub cmdSearch_Click()
Dim strSQL As String, strOrder As String, strwhere As String
strSQL = "SELECT * FROM table"
strwhere = " WHERE"
strOrder = " ORDER BY table.ID;" 'ID is the unique identifier
''searchinfo' is the textbox with the search information
strwhere = strwhere & " (table.field) Like '*" & Me.searchinfo & "*'"
'Pass the SQL to the 'Record Source' of the listbox
Form_nameofForm.RecordSource = strSQL & " " & strwhere & "" & strOrder
Form_nameofForm.Requery
End Sub