Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL - Like problem

Status
Not open for further replies.

HaworthBantam

Programmer
Jan 31, 2002
132
GB
I have an ADODC data object on a form, connecting to a backend Access97 database, within a VB6.0 application.

My problem is with the SQL string. The following string works....

strMySQL = "SELECT * FROM tblBankGiro WHERE Name = " & "'" & strNameSearch & "'"

Obviously here the user is keying the full name which is assigned to the parameter strNameSearch.

What doesn't work is the following....

strMySQL = "SELECT * FROM tblBankGiro WHERE Name Like " & "'*" & strNameSearch & "*'"

This has got to be something obvious that I'm missing, any help would be greatly appreciated.

Thanks.
 
strMySQL = "SELECT * FROM tblBankGiro WHERE Name Like " & "'%" & strNameSearch & "%'"

Use percent signs instead of asterisks.
 
Thanks CCLINT, I'd just figured it out myself when I received your notification mail. I shall now go away and shoot myself !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top