Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Between Dates When Left Blank

Status
Not open for further replies.

gimmyd

Technical User
Apr 12, 2002
36
US
I am using an unbound form with various unbound text boxes as the source for a query's criteria. One of the optional unbound text boxes is a beginning date and an ending date for one field on the query. I am using the Between [beginning date] And [ending date] format as criteria for this particular field. If the user leaves these date text boxes blank on the form the query returns no records. I am familiar with using the Like "*" & format for text fields. Is there a similar way to handle the Between format so that if text boxes are left blank the query will return all dates for this field?
 
You could use an IIF Statement for the begin and end dates that would appear something like this:


IIF(Is Null([BeginDate]),1/1/(Year(Now()),[BeginDate])

And for the EndDate use 12/31/(Year(Now())
 
Thanks, this accomplishes partly what I needed but I failed to mention that some of the records carry a blank in this field. These records are queried out. Is there a way that I can return records that have no data in the date field.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top