Parameter Query For Selected Dates or All Dates

M

Michael

Hi Folks - I'm having a senior moment. I have a query with a date field. I
want to use Between [Start Date] and [End Date] to choose a date range, but
if the user leaves the parameters blank, I want all records returned. I was
able to do this when I passed a form control to the query, but I can't
figure out how to do it within the criteria row of the query. Any help would
be appreciated. Thanks.
 
F

fredg

Hi Folks - I'm having a senior moment. I have a query with a date field. I
want to use Between [Start Date] and [End Date] to choose a date range, but
if the user leaves the parameters blank, I want all records returned. I was
able to do this when I passed a form control to the query, but I can't
figure out how to do it within the criteria row of the query. Any help would
be appreciated. Thanks.

As criteria on the Date column, write:
Between [Start Date] and [End Date]
on the next line down, write:
[Start Date] Is Null

if [Start Date] is left blank you'll get all the records, otherwise
just those within the entered range of dates.
 
M

Michael

Fredg - That's the ticket ... Thanks.




fredg said:
Hi Folks - I'm having a senior moment. I have a query with a date field.
I
want to use Between [Start Date] and [End Date] to choose a date range,
but
if the user leaves the parameters blank, I want all records returned. I
was
able to do this when I passed a form control to the query, but I can't
figure out how to do it within the criteria row of the query. Any help
would
be appreciated. Thanks.

As criteria on the Date column, write:
Between [Start Date] and [End Date]
on the next line down, write:
[Start Date] Is Null

if [Start Date] is left blank you'll get all the records, otherwise
just those within the entered range of dates.
 

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