View Full Version : IIF in Query Criteria Employing the Like "*"


ions
01-05-2009, 01:38 PM
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.

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.

Ziggy1
01-05-2009, 02:46 PM
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])&"*"

ions
01-06-2009, 06:50 AM
Thanks Ziggy works great.