|
-
March 17th, 2001, 03:37 PM
#1
search for simliar text
My VB application provides a search facility for user to search for a particular restaurant.
the application allow the user to enter the restaurant name and search against the database (MS access) and return with record that have similar name.
i use the SQL:
Search_Data1.DatabaseName = App.Path & "\eat&go out guide.mdb"
Dim qry
qry=" SELECT Restaurants.RestName FROM Restaurants"
qry = qry + " WHERE Restaurants.RestName LIKE" + "'" + "%" text1.text + "%" + "'"
Search_Data1.RecordSource = Qry
so if the user enter "royal" in the text box, it should return all records with name that had "royal" ..but it doesn't work..
can anyone tell me what is wrong with the query....thanks
-
March 17th, 2001, 04:12 PM
#2
Re: search for simliar text
Access does not use the % character as a wildcard, instead it uses the * character. Try this queury instead.
qry=" SELECT Restaurants.RestName FROM Restaurants"
qry = qry + " WHERE Restaurants.RestName LIKE" + "'" + "*" text1.text + "*" + "'"
Search_Data1.RecordSource = Qry
I hope this helps you.
Sean Wilkening
IVR/CTI Programmer Analyst
-
March 17th, 2001, 07:53 PM
#3
Re: search for simliar text
qry=" SELECT Restaurants.RestName FROM Restaurants"
qry = qry + " WHERE Restaurants.RestName LIKE '%" & text1.text & "%'"
Iouri Boutchkine
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|