Access 2003 query based on User Input - how to do "anywhere in fie

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an application where a user clicks a menu button and is prompted to
enter the name of a city they want - and then a report based on this query
results runs.

but my query isn't working because the city might be in ANY PARTof the city
field, and it seems like the query default is to match the whole field.
In the query criteria I have [Enter City]

How do I change this to look anywhere in the field as opposed to matching
the whole field?
 
That doesn't work.
Changed [enter city]
to
Like [enter city]
and that doesn't work. Still seems to want to match whole field


Frank Stepanski said:
Hi,

Use the Like keyword in the criteria in the query.

Frank Stepanski

FrankSpokane said:
I have an application where a user clicks a menu button and is prompted to
enter the name of a city they want - and then a report based on this query
results runs.

but my query isn't working because the city might be in ANY PARTof the city
field, and it seems like the query default is to match the whole field.
In the query criteria I have [Enter City]

How do I change this to look anywhere in the field as opposed to matching
the whole field?
 
I have an application where a user clicks a menu button and is prompted to
enter the name of a city they want - and then a report based on this query
results runs.

but my query isn't working because the city might be in ANY PARTof the city
field, and it seems like the query default is to match the whole field.
In the query criteria I have [Enter City]

How do I change this to look anywhere in the field as opposed to matching
the whole field?

Use a criterion of

LIKE "*" & [Enter city:] & "*"

The LIKE operator recognizes wildcards such as * (which means "match
any string") so this will find LAKE PLACID, SALT LAKE CITY, or
BLAKESLEE if the user enters "lake".

John W. Vinson[MVP]
 

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

Back
Top