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

Instr syntax ques

Status
Not open for further replies.

dumdum2

Programmer
Mar 18, 2000
98
GB
I'm trying to get an expression to work in a query....I want to be able to pull records based on a field on a form, let's say [forms]![form1]![field1], but the records i want to pull do not need to exactly match [forms]![form1]![field1], they just need to include [forms]![form1]![field1].

so if [forms]![form1]![field1]="ph", i want to be able to pull records that have "ph", but also "ph/p" and "p/ph" and "ph/mm" and so on....

but also, [forms]![form1]![field1] may also be left blank...

so i'm stuck how to get a query expression to work in this scenario....

thanks!
 
Try:
[tt]Like [forms]![form1]![field1] & "*"[/tt]
If you want the answer to begin with [forms]![form1]![field1]. Or
[tt]Like "*" & [forms]![form1]![field1] & "*"[/tt]
If it can be anywhere in the field.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top