-
Hello to all developers :-)
I am developing small Dictionary. Yes, but I also have one problem or question. How can be SQL string changed to search not only one equal word. For example:
If I insert 'car' it will display only one result word 'car'
But I need also to find out words like: carrer, carnage ... that are already in my Access97 MDB file. So, how to build up string, that would display me all words like ' *car* '.
At the moment I am using textbox for displaying search results ... also how to show more results inside textbox if my SQL string would provide me more results for one keyword?
My code:
... ... ...
strSQL = "PARAMETERS [SearchingWord] TEXT; " & _
"SELECT * FROM Words WHERE " & _
"Slo LIKE [SearchingWord]"
' Slo is one field inside table Words
Set qd = db.CreateQueryDef("", strSQL)
qd.SQL = strSQL
On Error GoTo Errorpoint
Set rs = qd.OpenRecordset(dbOpenForwardOnly)
On Error GoTo 0
... ... ...
Best regards, Leader
-
Search on sql
Why don't you use the DBcombi box + sql.
Use the combi box to find the car or carnage and the sql for the querry.
for example select * from recordsource where fieldname = dbcombi.text
Johan
-
You can also use a wildcard in your query for example add a %-sign to the end of your searchword:
"SELECT * FROM Words WHERE " & _
"Slo LIKE "Car%""
Or if you would like to find words that containt car (not just begin with it) try:
"SELECT * FROM Words WHERE " & _
"Slo LIKE "%Car%""
Goodluck
Another Johan
-
Your correct coding because you are using a varible from within VB would be :
"SELECT * FROM Words WHERE " & _
"Slo LIKE [%" & text1.text & "%]"
Hope this helps
Mega