softwareguy74
Sep 22nd, 2000, 04:23 PM
Hi,
I'm trying to construct a "wildcard" SQL statement such as:
Dim sSQL as String
Dim sSearchFor as String
sSearchFor = Text1.Text
sSQL = "SELECT * " _
& "FROM tblTest " _
& "WHERE Field1 LIKE '*" & sSearchFor & "*'"
Set rs = New RecordSet
rs.Open sSQL, db
The idea being that the user can enter any text in Text1 and it will find any record where Field1 contains the text that the user entered..
But, it does not seem to be returning any records. It does not seem to like the wildcards.. It doesn't error out, but it just doesn't return any records... And yes, I have verified that the text does in fact exist in the database.. When I remove the * signs, then the records are returned, if I enter the whole Field1 text..
Any idea on how to make this thing work?
Thanks,
Dan
I'm trying to construct a "wildcard" SQL statement such as:
Dim sSQL as String
Dim sSearchFor as String
sSearchFor = Text1.Text
sSQL = "SELECT * " _
& "FROM tblTest " _
& "WHERE Field1 LIKE '*" & sSearchFor & "*'"
Set rs = New RecordSet
rs.Open sSQL, db
The idea being that the user can enter any text in Text1 and it will find any record where Field1 contains the text that the user entered..
But, it does not seem to be returning any records. It does not seem to like the wildcards.. It doesn't error out, but it just doesn't return any records... And yes, I have verified that the text does in fact exist in the database.. When I remove the * signs, then the records are returned, if I enter the whole Field1 text..
Any idea on how to make this thing work?
Thanks,
Dan