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

want to use LIKE operator

Status
Not open for further replies.

RushiShroff

Programmer
Jan 23, 2002
216
IN
I have in my tabe 10 column out of which in one column there is city field. I want to use filter using LIKE operator with the city field.City contains Mumbai, Mum-21 etc.I want to use "select * from table where city LIKE MUM %" SO that all city records starting with MUM will be displayed.
This query not working.Any clues please ??

Please !!
 
RushiShroff,
Create a query using the table with the appropriate fields.
Select these fields and place in the query grid.
Under your field.city, in the criteria section, enter;
Like [Enter city name and a *]
Don't forget the brackets.
When you run the query a "Parameter Box" will appear asking to "Enter city name". You can enter any combination of letters you want.
Mum*
will produce all records starting with those three letters.
jim
 
RushiShroff
The other way to do this is...
Like [Enter City] & "*"

Then, you can enter one, or two, or any number of characters you wish. For example, entering W would pull up all cities starting with the letter W.

Still another (better) way is to put an unbound text box on a form that will drive the report. Let's call the text box txtCity. On the form will also be a command button to open the report upon which the query is based. In the query itself, in the city column, put the following...
Like Forms!YourFormName!txtCity & "*"

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top