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]),"*");
 

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

Similar Threads

Parameter Query 5
parameter date question 3
criteria for date range 10
Criteria For Date Range 2
Date parameters in a query 3
Parameter query question 4
query date question 6
group by query 3

Back
Top