Show all dates if user does not enter a date range

S

Sierras

Hello

I have an unbound control which allows users to input some parameters
to search for data. One of them is a date range. Something like
this;

between [Forms]![Search Form]![txtStartDate] and [Forms]![Search
Form]![txtEndDate]

This works very well when users fill in the parameters as well as the
date range. However, the report comes up empty if the users do not
enter a date to search for.

I would like that the reports brings back all dates if the field is
left empty. In the other search fields, I've used a control like
this:

Like "*" & [Forms]![Search Form]![Search1] &"*"

This works well for text and number fields. But not for dates.
Anyone know how to get around this for dates??

Thanks
 
J

John Vinson

Anyone know how to get around this for dates??
Try

= NZ([Forms]![Search Form]![txtStartDate], #1/1/100#)
and <= NZ([Forms]![Search Form]![txtEndDate], #12/31/9999#)
 
M

Mike Painter

John Vinson said:
Anyone know how to get around this for dates??
Try

= NZ([Forms]![Search Form]![txtStartDate], #1/1/100#)
and <= NZ([Forms]![Search Form]![txtEndDate], #12/31/9999#)
Neat. As a professor of mine used to say, the only thing wrong with it is
that I didn't think of it.
 

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