Is field between date range on form

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!
 
K

KARL DEWEY

Try this --
(Between [Forms]![frmReportSearch]![txtStartDate] And
[Forms]![frmReportSearch]![txtEndDate]) OR
([Forms]![frmReportSearch]![txtStartDate] Is Null)
 
C

consjoe

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!
 

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

Top