Hi I am trying to do an IIf statement for my query criteria. It tests if a form's two date fields are null. If so, then just list all cases for the field. If not (i.e. form field is filled) then only list those that fall between two dates from the form. I have tried everything but to no avail. This is what I had but it does not work. What can I do to get the "between dates" behavior?
Criteria:
Note that [Date] is the query field itself.
I have tried
and
to no avail. What is the correct way to get a between dates in an IIf statement to be displayed?
Criteria:
Code:
IIf(IsNull([Forms]![frm_Search]![StartDate]) Or IsNull([Forms]![frm_Search]![EndDate]),[Date],[Date]>=[Forms]![frm_Search]![StartDate] and [Date]<=[Forms]![frm_Search]![EndDate])
Note that [Date] is the query field itself.
I have tried
Code:
Date]>=[Forms]![frm_Search]![StartDate] and [Date]<=[Forms]![frm_Search]![EndDate]
and
Code:
Date]>=DateValue([Forms]![frm_Search]![StartDate]) and [Date]<=DateValue([Forms]![frm_Search]![EndDate])
to no avail. What is the correct way to get a between dates in an IIf statement to be displayed?