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

Searching Access Databases

Status
Not open for further replies.

Tezdread

Technical User
Oct 23, 2000
468
GB
Hi, does anyone know if there is a way to search text fields for a particular word without having to use the * (asterix) before and/or after the word you are searching for?

I am creating an FAQ database and I would like to be able to set it up so that the person logs on and on the switchboard they have the facility to search for a keyword. They would type in the keyword e.g. Motor, this would then search the Question field for instances of the word Motor, the results would show - Motor Car, Motor Bike, Damaged Motor etc....

At the moment when the search box appears the user will have to enter *Motor* for the same results and this isn't very practical because unless there is information explaining how to search the results would be limted.

Thanks in advance for any help! Tezdread
"With every solution comes a new problem"
 
can no one help? Tezdread
"With every solution comes a new problem"
 
Can you not take the string that they enter and use
initStr = textbox.text
searchStr = "*" & initStr & "*"

Then search for searchstr.....

HTH
Geoff
 
Geoff thank you for your help!

I am a little new to Access and I'm not completely sure I follow what you are saying? Sorry.

You say: "Can you not take the string that they enter and use
initStr = textbox.text
searchStr = "*" & initStr & "*"

First how would I take "the string that they enter"?
And are you saying that I should input this: initStr = textbox.text searchStr = "*" & initStr & "*" Into the criteria field within my query?

Thanks again! Tezdread
"With every solution comes a new problem"
 
Thanks for your help! The info on the Microsoft site was exactly what I needed....

It says to add this line into the criteria field of the query,

Like "*" & [Enter word ] & "*"

This worked ok, but not exactly what I wanted. Using the above method works like this.

If you search for "give more" and the fields only have "give me more" there will be no search results. However if you search for "give" it will show all the fields that have "give" in the results. If you were to do a search for "gi" again there would be no search results.

If you change the above criteria to include

Or Like "*" so the whole line reads

Like "*" & [Enter word ] & "*" Or Like "*"

This will give you the ability to search for "gi" or "give more" etc....works great! Tezdread
"With every solution comes a new problem"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top