How do I combine wildcard searches with parameter queries?

D

Dominik

I'm currently designing my first ever data base for our NGO, but I'm stuck on
running parameter queries. One of my tables contains a field called
"keywords", which contains a string of several different words. (Example:
"WordA WordB WordC WordD"). I need to design a user-friendly parameter query
where the user enters the keyword he is seaching for (Example: WordC) and
Access then queries all the "keyword" fields in the entire table for that
word.

1.) How do I design this query? I've tried combining a parameter query where
the user is prompted "Enter keyword you are looking for" with wildcards to
account for the other words in the string:
List *[Enter keyword you are looking for]*
This obviously doesn't work, as the brackets automatically become a wildcard
character themselves after the List command. Is there a way around this or do
I need to approach this differently?
2.) Is such a parameter query case sensitive? If yes, how do I get around
this problem?

Thanks a lot for any help/input!
Dominik
 
F

fredg

I'm currently designing my first ever data base for our NGO, but I'm stuck on
running parameter queries. One of my tables contains a field called
"keywords", which contains a string of several different words. (Example:
"WordA WordB WordC WordD"). I need to design a user-friendly parameter query
where the user enters the keyword he is seaching for (Example: WordC) and
Access then queries all the "keyword" fields in the entire table for that
word.

1.) How do I design this query? I've tried combining a parameter query where
the user is prompted "Enter keyword you are looking for" with wildcards to
account for the other words in the string:
List *[Enter keyword you are looking for]*
This obviously doesn't work, as the brackets automatically become a wildcard
character themselves after the List command. Is there a way around this or do
I need to approach this differently?
2.) Is such a parameter query case sensitive? If yes, how do I get around
this problem?

Thanks a lot for any help/input!
Dominik
Is this in an Access query?

Use the Like operator as criteria in the Keyword column, and
concatenate the asterisks with the entered text.

Like "*" & [Enter keyword] & "*"
You will be prompted for the keyword.
 
L

Larry Adams via AccessMonster.com

Thanks for this solution. It resolved a utility I've been trying to develop for my users.

With your input, I made a slight modification by having a form that the users enter the search phrase into. A single row, single field table is the data source for the form. I include the search phrase table in the query for the keyword search and include the folloiwng in the criteria row of the query:

Like "*" & [Table Of Search Text].[Text] & "*"

The form has a command button that activates a macro that runs the query after the keyword or search phrase is entered. The query will become the data source for a report to show the matching records in a particular format.


Larry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top