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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Like operator in Where Clause Syntax

Status
Not open for further replies.

Elysynn

Technical User
Mar 18, 2004
82
US
I'm using the following SQL statement for a search function. I'm having some problems with the like operator. If you could take a look and tell me what I've done wrong, I would appreciate it.

Code:
"SELECT tblCoreData.RecordNumber, tblCoreData.AgentName, tblCoreData.AgentID, tblCoreData.Site, tblCoreData.DateEntered" & _
" FROM tblCoreData" & _
" WHERE tblCoreData.AgentName Like '* " & txtSearchData & " & *';"

TIA,
Elysynn
 
Either:
" WHERE tblCoreData.AgentName Like '*" & txtSearchData & "*';"
Or:
" WHERE tblCoreData.AgentName Like '%" & txtSearchData & "%';"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks, PHV. I didn't even see the extra ampersand I had until I was comparing to your suggestions. Everything works and is happy now.

-Elysynn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top