Enter parameter once for multiple queries in a Macro

  • Thread starter Thread starter Randal
  • Start date Start date
R

Randal

I have 6 queries in a macro that all need the same parameter to run. Is
there a way to enter the parameter once for the entire macro instead of 6
times - once for each query as it runs?
 
I have 6 queries in a macro that all need the same parameter to run. Is
there a way to enter the parameter once for the entire macro instead of 6
times - once for each query as it runs?.
Are the queries record sources for reports?
Or free standing queries?

The below will need to be adapted to why the queries are being run and
how .

Make an unbound form in which to enter the parameters.
Where ever the queries have something like [Enter Start] change each
query criteria to
forms!FormName!ControlName

Add a command button to the form.
Code it's click event to
Me.Visible = False

Then you'll need to close the form AFTER all the queries are run.
How that is done depends on what you are doing.
 
I have 6 queries in a macro that all need the same parameter to run. Is
there a way to enter the parameter once for the entire macro instead of 6
times - once for each query as it runs?

The simplest is to create an unbound Form with a control (textbox,
combo, whatever's appropriate) and use it as the parameter:

=[Forms]![formname]![controlname]

Launch the macro from a button on the form, and all the user will need
to do is open the form, enter the criterion, and click.
 
Back
Top