M
Max Smart
My contacts database (Access 2000) has a custom search function to locate
last names. I use the following code in the Change event of my text box...
Private Sub txtLocate_Change()
If Trim((txtLocate.Text) & "") <> "" Then
strLocate = Trim((txtLocate.Text) & "")
CreateSQL
End If
End Sub
The Create SQL function builds an SQL string and populates a listbox on the
main contacts form using code like this...
strSelect = (my selection criteria goes here)
strWhere = "Contacts.[Last Name] LIKE '" & strLocate & "*'"
strOrderBy = (my order by string goes here)
strSQL = strSelect & " " & strWhere & " " & strOrderBy
lstContacts.RowSource = strSQL
The code work fine until I search for names with apostrophes (O'Connor,
etc.) - the listbox comes up blank.
What am I doing wrong???
Thanks,
Max
last names. I use the following code in the Change event of my text box...
Private Sub txtLocate_Change()
If Trim((txtLocate.Text) & "") <> "" Then
strLocate = Trim((txtLocate.Text) & "")
CreateSQL
End If
End Sub
The Create SQL function builds an SQL string and populates a listbox on the
main contacts form using code like this...
strSelect = (my selection criteria goes here)
strWhere = "Contacts.[Last Name] LIKE '" & strLocate & "*'"
strOrderBy = (my order by string goes here)
strSQL = strSelect & " " & strWhere & " " & strOrderBy
lstContacts.RowSource = strSQL
The code work fine until I search for names with apostrophes (O'Connor,
etc.) - the listbox comes up blank.
What am I doing wrong???
Thanks,
Max