IIF in Query Criteria Employing the Like "*"

ions

Access User
Local time
Today, 12:04
Joined
May 23, 2004
Messages
875
Dear MS Access Expert.

When I hardcode Like "*" into the query grid criteria section I get the correct results.

When I use the below IIF statement containing Like "*" the recordset is empty although the result should be the same as above.

Code:
IIf(IsNull([Forms]![Clean Solvent Reports]![Sales]),Like "*",[Forms]![Clean Solvent Reports]![Sales])

When I replace the Like "*" with "Peter" in the above statement I correctly get all Records for Peter.

CAn you please explain how I can make this work.

Thank you for your help.

Peter.
 
Just use this in the query field criteria and set your form control with a default value (in properties) of "*"

Like([Forms]![Clean Solvent Reports]![Sales])&"*"
 
Thanks Ziggy works great.
 

Users who are viewing this thread

Back
Top Bottom