Parameters - enter once

G

Guest

I have a number of queries that use the same paramater to pull data. The
queries report on or update different items in the database. How can I set
up up so they can enter the parameter once and all queries will use that
parameter when run? I launch all the queries via a macro so right now the
user must enter it (ie: Aug-06) many times while the macro runs everything.
 
D

Dirk Goldgar

Sarah at DaVita said:
I have a number of queries that use the same paramater to pull data.
The queries report on or update different items in the database. How
can I set up up so they can enter the parameter once and all queries
will use that parameter when run? I launch all the queries via a
macro so right now the user must enter it (ie: Aug-06) many times
while the macro runs everything.

Better would be to have a form that provides a text box or other control
for the user to enter the parameter, and a button to run the queries.
You would change all the queries to refer to the control on the form for
the parameter value; e.g.,

SELECT * FROM SomeTable WHERE
MonthYear = [Forms]![ParameterForm]![txtMonthYear];
 
J

Jeff Boyce

Sarah

Create a form.

Add a control to hold the "parameter".

Modify your queries to point to the form's control for the
parameter/selection criterion. It will look something like:
Forms![YourNewForm]![YourControl]

Make sure every query uses this "parameter".

This does NOT work if the form isn't opened.

This does NOT work if the control doesn't hold a parameter (or a valid
parameter).

You can add a command button to the form that runs your macro.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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