Parameter in Reports

G

Guest

I have a report that is based of the a query. The query is a combination of
15 other queries, which a main query that drives the others. I set the
parameters in the main query.

When I am running my report, I have to type the same parameter about 4 times
before the report starts to run.

Is there anyway where I can type the parameter once in the report to popup
the report?
 
M

[MVP] S.Clark

Put some controls on a form, then reference them as the parameters in the
query??
 
F

fredg

I have a report that is based of the a query. The query is a combination of
15 other queries, which a main query that drives the others. I set the
parameters in the main query.

When I am running my report, I have to type the same parameter about 4 times
before the report starts to run.

Is there anyway where I can type the parameter once in the report to popup
the report?

Create a form to enter the parameters in.
I'll assume it is date parameters you want to enter. Change as needed.

Create an unbound form. Add 2 Text Controls.
Name one StartDate and the 2nd EndDate.

Add a command button.
Code the button's click event:

Me.Visible = False

Name this form 'ParamForm'.

In each query, in it's Date field's criteria line, write:
Between forms!ParamForm!StartDate AND forms!ParamForm!EndDate

Next, code the main report's Open event:
DoCmd.OpenForm "ParamForm", , , , , acDialog

Code the main report's Close event:
DoCmd.Close acForm, "ParamForm"

When ready to run the report, open the report. The form will display
and wait for the entry of the dates. Click the command button and the
report will run without need for any further parameter entries. When
the report closes, it will close the form.

If you wish to show the parameters in the report:
Add an unbound control to the Report Header.
Set it's control source to:
= "For Sales between " & forms!ParamForm!StartDate & " AND " &
forms!ParamForm!EndDate
 
J

John Vinson

Is there anyway where I can type the parameter once in the report to popup
the report?

The simplest way is to launch the report from an unbound Form, and put
your parameters on the form itself. If you use a form named frmCrit,
with controls named txtThis, cboThat, and chkTheOther, you can use
criteria like

=[Forms]![frmCrit]![txtThis]

and so on. Put a command button on the form to launch the report and
the queries will pull their parameters from the form without
interrupting you.

John W. Vinson[MVP]
 
G

Guest

Hello Guys,
I wrote this today,

I am a beginner in Access. I was wondering step by step if someone could
help me?

I made a report that is based off of a query. The query has in total 15
queries and a main query that sets the parameter. So the parameters carry
over the 15 queries.
In my criteria field I set the parameters in the main query as followed:
[Enter CAT]
[Enter M&E]
[Enter COSO]

The report is based of this main query with a sub report from 1 of the 15
queries. When running the report it ask me to input the values three times
(CAT, M&E, and COSO), which is fine. But then it asks me to repeat the
values again for another 4 times before the report opens. Is there a way to
bypass all this and input the values just once so it can immediately populate
my report?

Remind you, when you enter one of the criteria's it will just return that
criteria’s value. If you input all three, it will return the population, and
so on. But I just want it once.
 
J

John Vinson

Hello Guys,
I wrote this today,

And I answered it yesterday. Did you try it?

Repeating:

The simplest way is to launch the report from an unbound Form, and put
your parameters on the form itself. If you use a form named frmCrit,
with controls named txtThis, cboThat, and chkTheOther, you can use
criteria like

=[Forms]![frmCrit]![txtThis]

and so on. Put a command button on the form to launch the report and
the queries will pull their parameters from the form without
interrupting you.
I am a beginner in Access. I was wondering step by step if someone could
help me?

1. Create a new Form, with nothing in its Recordsource property (when
the form designer asks you which table or query, leave it blank).

2. Save the form as frmCrit.

3. Put three textboxes (or combo boxes, or other appropriate controls)
on frmCrit, named txtCat, txtMandE, txtCOSO.

4. Change your criteria from

[Enter CAT]

to

[Forms]![frmCrit]![txtCAT]

and so on for the other fields.

5. Base your Report on this query.

6. Put a button on frmCrit, using the Command Button wizard, to launch
your report.


John W. Vinson[MVP]
 
G

Guest

thank you all for your help


John Vinson said:
Hello Guys,
I wrote this today,

And I answered it yesterday. Did you try it?

Repeating:

The simplest way is to launch the report from an unbound Form, and put
your parameters on the form itself. If you use a form named frmCrit,
with controls named txtThis, cboThat, and chkTheOther, you can use
criteria like

=[Forms]![frmCrit]![txtThis]

and so on. Put a command button on the form to launch the report and
the queries will pull their parameters from the form without
interrupting you.
I am a beginner in Access. I was wondering step by step if someone could
help me?

1. Create a new Form, with nothing in its Recordsource property (when
the form designer asks you which table or query, leave it blank).

2. Save the form as frmCrit.

3. Put three textboxes (or combo boxes, or other appropriate controls)
on frmCrit, named txtCat, txtMandE, txtCOSO.

4. Change your criteria from

[Enter CAT]

to

[Forms]![frmCrit]![txtCAT]

and so on for the other fields.

5. Base your Report on this query.

6. Put a button on frmCrit, using the Command Button wizard, to launch
your report.


John W. Vinson[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