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
 
Ad

Advertisements

G

Guest

Try this instead

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

Advertisements

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
Reusable statements in queries 2
iif in the criteria 2
Append record with Yes/No 1
Finding null 4
nested compound boolean IIf statements 1

Top