Parameter Query For Selected Dates or All Dates

  • Thread starter Thread starter Michael
  • Start date Start date
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.
 
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.
 
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.
 
Back
Top