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

Using LIKE operator in IIF function

Status
Not open for further replies.

databuilt

Programmer
Apr 4, 2003
20
US
I am constructing a query for a form (and report) which has input parameters. One of the parameters is for the item number and the users want to enter partial data and return all matching items.

The problem I am having is in scripting the criteria.

I am using :
For field: IBLITM
criteria: IIf([ItemLike]<>&quot;&quot;,(Like [ItemLike]+&quot;*&quot;),[IBLITM])

This returns all items wen the parameter field ([ItemLike]) is blank (OK so far), but returns no records when a (any valid begining string)parameter is given.

Conversly, if I just use: Like [ItemLike]+&quot;*&quot; as the crieria, I can return the appropriate results. Unfortunately, this requires the user to enter a string &quot;*&quot; to get all items.

Is there another way to get the IIF() working such that the user just user can just click OK (leaving the parameter field blank). Or... alternately defaulting the parameter to &quot;*&quot;??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top