Multiple queries same parameter

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

Guest

I have multiple queries using the same parameter, Is there a way to store the
parameter on a form so it can be reference. Example:The first time the user
go into the application, there is a form for reports, when clicking the
command button the user will enter plant code if it doesn't exist or will
pick up parameter and not ask the user.
 
hi,
is the plant code the parameter?
if so then in your queries you could enter this
[forms]![yourform]![Plantcodetextbox] as the criteria
(parameter).
 
Just to expand a little, create a form with unbound text boxes or combo boxes
for the field or fields that will be used as parameters. Give the form and
the controls short, simple names. For now, the form is frmParam, and the
combo box on the form is cboName. Set the form properties to Pop-up and
Modal. Add a command button to the form, with the Click event set to
Me.Visible = False. In the underlying query for a report, reference the form
on the Criteria line thus:
Forms![frmParam]![cboName]
Back to the report, add the following to the On Open event:
DoCmd.OpenForm "frmParam", , , , , acDialog
When you open the report, it will open the form and then wait for a response
from you. When you enter the parameter and click the command button (which
can have a label "Open Report", but which will actually hide the form), the
parameters will be applied to the report.
Ordinarily I would add code to the report's On Close event to also close
frmParam, but you will need to keep it open until you are done with all of
the reports. I think it will work to have the code to open the form in the
Open event of each report, and even if the form is already open but hidden it
will appear as it should. If not, you will need to do something like open
frmParam ahead of time but make it invisible, and instead of opening it when
you open a report you would make it visible instead.
This is kind of a lot of stuff all at once. I would suggest trying this
with a single report to get familiar with how it works. Later you can try
adding other reports.
hi,
is the plant code the parameter?
if so then in your queries you could enter this
[forms]![yourform]![Plantcodetextbox] as the criteria
(parameter).
-----Original Message-----
I have multiple queries using the same parameter, Is there a way to store the
parameter on a form so it can be reference. Example:The first time the user
go into the application, there is a form for reports, when clicking the
command button the user will enter plant code if it doesn't exist or will
pick up parameter and not ask the user.
.
 
Back
Top