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

SEARCH IN SQL STRING

Status
Not open for further replies.

turnerk200

Programmer
Mar 9, 2004
20
0
0
AU
I have a form which is used for searching, i am using a field called "txtMatterName", in this field, for example i want people to be able to type "turner", and the code will find anything in the field with "turner" in it, for example "Ray Turner". I am doing this by opening a record set with a SQL string and using a wildcard character, unfortunately this does not work! Here's is an example of my SQL string, i know I have the wrong syntax where i have the wildcard (I think) but cannot make it work! I have done this before but cannot seem to remember, please can somebody help.

strsql2 = "SELECT tblTaskPrimary.MatterNo, tblTaskPrimary.MatterStatus, tblTaskPrimary.MatterName, tblTaskPrimary.PolicyNo, tblTaskPrimary.DateReceived, tblTaskPrimary.Description FROM tblTaskPrimary WHERE tblTaskPrimary.MatterName Like Forms!frmSearch!txtMatterName & " * ";"

Thank you.

 
Change the end of the code to this:

Code:
'" & Forms!frmSearch!txtMatterName & "*';"

Let me know if that works for you.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]
 
Thank you!! Yes it works, so simple yet drove me crazy!
kt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top