help with iif statement

paulevans

Registered User.
Local time
Today, 10:10
Joined
Mar 7, 2006
Messages
79
Hi
I am try ing to create a query that sorts records in a table based on a filed on a form in order to produce a report.

I have a field on a form called customer

in my query for the report I want to sort customers in my table by their name if given on the form or to show all records if not.

I came up with the following code in my criteria

iif(isnull(forms![tender]![customer]),like *,forms![tender]![customer])

the like * i was trying to use as a wild card for all customers if the field on the form was left blank.

if I enter a valid name on my form the query runs fine. but If I leave the field blank then I do not get to see any record where I want them all.

Thanks for any help in advance
 
not too sure but have you tried

like "*"
 
Hi Ray

Thanks I did try that and it did not work. I did a search on the forum after the post and found the answer I was looking for from another post.

and came with a sample db,

Thanks all
 

Users who are viewing this thread

Back
Top Bottom