|
-
Apr 6th, 2001, 02:57 AM
#1
Thread Starter
New Member
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
-
Apr 6th, 2001, 03:23 AM
#2
Junior Member
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
-
Apr 6th, 2001, 04:47 AM
#3
Lively Member
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
"Do, or do not. There is no 'try'. "
- Yoda ('The Empire Strikes Back')
__________________
-
Apr 6th, 2001, 08:48 AM
#4
Frenzied Member
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
"If at first you don't succeed, then skydiving is not for you"
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
|