IIF Statement in Criteria

G

Guest

I am trying to make an IIF statement work properly in a Query.

In my mind I want it to do this:

IIF(IsNull([Forms]![myForm]![Field1])=True,Like "*",Between
[Forms]![myForm]![Field1] AND [Forms]![myForm]![Field2])

Saying that if Field1 is Null I want ALL and if not null then I want
Between. But this statement does not work.

I appreciate your help on this.

Thank you.

Steven
 
G

Guest

Try this instead

Where FieldName Between [Forms]![myForm]![Field1] AND
[Forms]![myForm]![Field2] Or [Forms]![myForm]![Field1] Is Null
 
M

Marshall Barton

Steven said:
I am trying to make an IIF statement work properly in a Query.

In my mind I want it to do this:

IIF(IsNull([Forms]![myForm]![Field1])=True,Like "*",Between
[Forms]![myForm]![Field1] AND [Forms]![myForm]![Field2])

Saying that if Field1 is Null I want ALL and if not null then I want
Between. But this statement does not work.


Set the criteria to:

Between [Forms]![myForm]![Field1]
AND [Forms]![myForm]![Field2]
OR [Forms]![myForm]![Field1] Is Null
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Null Criteria Problem 4
iif in the criteria 3
IIF in Query 2
iif in the criteria 2
Checkbox controlled criteria 2
no criteria 3
How to display multiple IIf results in one column 1
Finding null 4

Top