Can I use wildcards in a parameter search?

P

Piperlynne

I'm trying to allow the user to input a few letters to a whole word to search
a field to bring up results for a report. I have no idea how to do this
properly. I've tried going the route of doing this within separate queries,
but I'm not sure the simplest yet most effective way to do this.
 
F

fredg

I'm trying to allow the user to input a few letters to a whole word to search
a field to bring up results for a report. I have no idea how to do this
properly. I've tried going the route of doing this within separate queries,
but I'm not sure the simplest yet most effective way to do this.

Let's assume you wish to search a [City] field.
In the query that is used as the report's record source, as criteria
on the [City] column, write:

Like [Enter starting letters] & "*"
to return all records where the City field begins with the entered
letters.
Enter chi and cities like Chicago or Chino will be returned.

Like "*" & [Enter ending letters]
to return all records where the City field ends with the entered
letters.
Enter ord and cities like Hartford or Hanford will be returned.

Like "*" & [Enter any letters in the city] & "*"
to return records where the City field contains those letters anywhere
in the field.
Enter ort and cities like Newport or Portland will be returned.

You will be prompted for the letters.
 
M

Marshall Barton

Piperlynne said:
I'm trying to allow the user to input a few letters to a whole word to search
a field to bring up results for a report. I have no idea how to do this
properly. I've tried going the route of doing this within separate queries,
but I'm not sure the simplest yet most effective way to do this.


You can use a criteria similar to:

Like "*" & Forms!theform.thetextbox & "*"
or if you are still using query parameter prompts:
Like "*" & [Enter some letters] & "*"
 

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