Newbie: best way to send a value to many queries at once

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have many queries that do different things depending upon a user-entered
number. I want to put these queries in one report so that the user can open
the report, enter the number and all the queries will display the results for
that number entered.

I have created a report (based on the first query) and added the other
queries as subreports...now they are all in the same report.

When I open the report, however, I am asked many times to enter the same
number since each query wants that number to calculate. Now I need to have
the user enter the number once and have that number sent to each query in
that report. How best to do this?

TIA
 
create an unbound form and place a field on that form for the entry. Then,
use that field in your query. In the query instead of putting a parameter
like...

=[Enter Some Number]


put...

=Forms![MyFormName]![MyFieldName]
 
Thanks, Rick....
I must be missing something:

I created the unbound form with a field called 'YEAR.' ('unbound' form
means it is not built upon any query or table right?)

Then instead of writing [Put the year you want a report for] in the criteria
row of the queries I put =form![myform]![YEAR]

When I build a report based upon one of these queries-and then include the
others as subreports, I am still required to enter the year 5 times (once for
each query in that report) each time I open the report.

I want to have the user just enter the year once and all the 5 queries will
do their work based upon that same year. (ie; one query figures number of
sales in that year, the other figures the number of employees hired in that
year, etc.)

Thanks for any help
 
First, I would find a different name than "Year" which is a reserved word.

Does your form remain open when you run this report? IS the criteria
identical for each query/report/subreport?

--
Rick B



PaulFort said:
Thanks, Rick....
I must be missing something:

I created the unbound form with a field called 'YEAR.' ('unbound' form
means it is not built upon any query or table right?)

Then instead of writing [Put the year you want a report for] in the criteria
row of the queries I put =form![myform]![YEAR]

When I build a report based upon one of these queries-and then include the
others as subreports, I am still required to enter the year 5 times (once for
each query in that report) each time I open the report.

I want to have the user just enter the year once and all the 5 queries will
do their work based upon that same year. (ie; one query figures number of
sales in that year, the other figures the number of employees hired in that
year, etc.)

Thanks for any help

Rick B said:
create an unbound form and place a field on that form for the entry. Then,
use that field in your query. In the query instead of putting a parameter
like...

=[Enter Some Number]


put...

=Forms![MyFormName]![MyFieldName]
 
My bad.
I had the format of the YearBox field on the form set to 'general number. '
and the form was not always in Form View.
It works now...
Thanks much, Rick.
 
Back
Top