Using one date range in four queries

  • Thread starter Thread starter Stephen Epstein
  • Start date Start date
S

Stephen Epstein

I've developed a set of queries developing the data for a report.
Eventually I'll write a macro to run them in sequence for end users'
convenience. Problem is this: Of the 6 queries used, 4 rely on the same
date range (e.g. transaction date between beginning_date and ending_date).
Is there a simple way to enter the beginning and ending dates one time and
pass the parameters to the selection criteria of all 4 queries so that the
macro won't ask 4 times for the same dates?
TIA
SteveE
 
Create an unbound form with 2 text boxes.

Remove the parameters from your query, and refer to the text boxes on the
form instead. The Criteria row under your date field will look something
like this:

Between [Forms]![MyForm]![beginning_date] And [Forms]![MyForm]![ending_date]

Do the same in the other queries.
BTW, be sure to set the Format property of these text boxes to Short Date or
similar so Access knows they are dates.
 
Thanks Allen, I'll give that a shot!
Allen Browne said:
Create an unbound form with 2 text boxes.

Remove the parameters from your query, and refer to the text boxes on the
form instead. The Criteria row under your date field will look something
like this:

Between [Forms]![MyForm]![beginning_date] And [Forms]![MyForm]![ending_date]

Do the same in the other queries.
BTW, be sure to set the Format property of these text boxes to Short Date or
similar so Access knows they are dates.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Stephen Epstein said:
I've developed a set of queries developing the data for a report.
Eventually I'll write a macro to run them in sequence for end users'
convenience. Problem is this: Of the 6 queries used, 4 rely on the same
date range (e.g. transaction date between beginning_date and ending_date).
Is there a simple way to enter the beginning and ending dates one time and
pass the parameters to the selection criteria of all 4 queries so that the
macro won't ask 4 times for the same dates?
 
Back
Top