Create search box on form

HappyApple

Registered User.
Local time
Today, 12:11
Joined
Jan 10, 2003
Messages
15
Hi guys, I wonder if anybody can help me?

I need to create a search box on a form that would work similar to a google search. So if I put 'BLUE BOOTS' into the text box it would find anything that contained these words no matter what order they were in. for example it would return 'BOOTS THAT ARE BLUE' or 'PINK BOOTS WITH BLUE SPOTS ON THEM'

Can anybody help because I just so stuck :-(
 
Thank you but this is not what I'm after. The example you give is searching one word in multiple fields --- What I need is to search multiple words in ONLY 1 field.

Any other ideas?
 
You can limit it to only one field, do not go for the OR option. Just the field you want can be searched upon.. However will not give you the desired result.. As using the LIKE operator searches for a Pattern string.. if you say BOOTS, it will give all the Fields that have the word boots in it.. However if you search for BLUE boots, it will return only the field that actually matches the pattern... Eg.. Consider data in field,
Blue boots
Pink boots
Brown boots with Blue dots
Brown boots with Pink lines
If you search for Blue boots only the First one will be returned, but if you search for Pink or blue it will return 'Pink boots', 'Brown boots with Pink lines' and 'Blue boots', 'Brown boots with Blue dots' respectively..

If you want you can create a custom Search function, give an unbound Form with all options, then you can create a Query on the fly to get the desired result.
 
thank you, as I thought... its sounding like what I am after is not really a possibility.

Thank you anyway :-)
 
The attached Access 2000 database should give you some clues on one way to achieve what you're after.

The function buildWhereClause() takes three parameters (fieldName, searchString and searchMethod) and builds a filter for the records.

I hope this is useful.
 

Attachments

Alternatively you could take a look at How to filter records in an Access database, go into "Filter By Form" mode and type the following as a criteria of the field required.

Code:
Like "*blue*" AND Like "*brown*"

This is effectively what my BuildWhereClause() function does for you.
 

Users who are viewing this thread

Back
Top Bottom