Date range parameters

  • Thread starter Thread starter Al Camp
  • Start date Start date
A

Al Camp

In a query, in a date field, I have the following
parameter/criteria...
Between [Enter Start Date] And [Enter End Date]

I'd like to offer the user the option of entering a date range to
limit
the resulting records,
OR... enter nothing in response to the parameters, and get ALL
dates returned.

In this non-date example...
Like [Enter Customer Name] & "*"
the user can just hit the ENTER key, and all Customer Names will
be displayed.

Can I do the same for my DATE parameters??

Thanks,
Al Campagna
 
Use an IF statement. Something like...

IIF Enter Start Date not null and Enter End Date not null then between start
and end, otherwise, show all.

Rick B


In a query, in a date field, I have the following
parameter/criteria...
Between [Enter Start Date] And [Enter End Date]

I'd like to offer the user the option of entering a date range to
limit
the resulting records,
OR... enter nothing in response to the parameters, and get ALL
dates returned.

In this non-date example...
Like [Enter Customer Name] & "*"
the user can just hit the ENTER key, and all Customer Names will
be displayed.

Can I do the same for my DATE parameters??

Thanks,
Al Campagna
 
In a query, in a date field, I have the following
parameter/criteria...
Between [Enter Start Date] And [Enter End Date]

I'd like to offer the user the option of entering a date range to
limit
the resulting records,
OR... enter nothing in response to the parameters, and get ALL
dates returned.

In this non-date example...
Like [Enter Customer Name] & "*"
the user can just hit the ENTER key, and all Customer Names will
be displayed.

Can I do the same for my DATE parameters??

Thanks,
Al Campagna

Try it like this:

WHERE YourTable.DateField Between [EnterStart] And [EnterEnd] OR
YourTable.DateField) Like IIf(IsNull([EnterStart]),"*");
 
Fred,
Just the ticket!!
Thanks a lot,
Al Campagna

fredg said:
In a query, in a date field, I have the following
parameter/criteria...
Between [Enter Start Date] And [Enter End Date]

I'd like to offer the user the option of entering a date range to
limit
the resulting records,
OR... enter nothing in response to the parameters, and get ALL
dates returned.

In this non-date example...
Like [Enter Customer Name] & "*"
the user can just hit the ENTER key, and all Customer Names will
be displayed.

Can I do the same for my DATE parameters??

Thanks,
Al Campagna

Try it like this:

WHERE YourTable.DateField Between [EnterStart] And [EnterEnd] OR
YourTable.DateField) Like IIf(IsNull([EnterStart]),"*");
 
Back
Top