Is field between date range on form

  • Thread starter Thread starter consjoe
  • Start date Start date
C

consjoe

I have a form with a start date and an end date field. I want a user to
either put dates in these fields or leave blank for all. I can't get the
query to work if the fields are left blank. The code I have in my query is
below.

IIf(IsNull([Forms]![frmReportSearch]![txtStartDate]),,(Between
[Forms]![frmReportSearch]![txtStartDate] And
[Forms]![frmReportSearch]![txtEndDate]))

(FYI..End date is required if Start date is not null)
Thanks!
 
Try this --
(Between [Forms]![frmReportSearch]![txtStartDate] And
[Forms]![frmReportSearch]![txtEndDate]) OR
([Forms]![frmReportSearch]![txtStartDate] Is Null)
 
Wow, should have posted that question 24 hours ago.
It works perfect, thanks so much!!

KARL DEWEY said:
Try this --
(Between [Forms]![frmReportSearch]![txtStartDate] And
[Forms]![frmReportSearch]![txtEndDate]) OR
([Forms]![frmReportSearch]![txtStartDate] Is Null)


consjoe said:
I have a form with a start date and an end date field. I want a user to
either put dates in these fields or leave blank for all. I can't get the
query to work if the fields are left blank. The code I have in my query is
below.

IIf(IsNull([Forms]![frmReportSearch]![txtStartDate]),,(Between
[Forms]![frmReportSearch]![txtStartDate] And
[Forms]![frmReportSearch]![txtEndDate]))

(FYI..End date is required if Start date is not null)
Thanks!
 
Back
Top