IIF Statement in Criteria

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
Try this instead

Where FieldName Between [Forms]![myForm]![Field1] AND
[Forms]![myForm]![Field2] Or [Forms]![myForm]![Field1] Is Null
 
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
 
Back
Top