parameter query in sub report

G

Guest

My report and subreport are generate from the same query. I have used a
parametery query for the main report. As separate reports they works fine,
but when used together, I keep geting non-ending rquests for the parameter.
 
F

fredg

My report and subreport are generate from the same query. I have used a
parametery query for the main report. As separate reports they works fine,
but when used together, I keep geting non-ending rquests for the parameter.

Use a form to enter the date parameters into.

Let's assume the parameters are for start date and end date.
Create an unbound form.

Add 2 unbound text controls.
Set their format to a valid date format.
Name them "StartDate" and "EndDate"

Add a Command Button to the form.
Code the button's click event:

Me.Visible = False

Name this form 'ParamForm'.

As criteria in the query date field of each query, 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 open and wait for the entry of the starting and ending
dates wanted.
Click the command button and the report will run.

The sub-report will show the same date range.

When the report closes, it will close the form.
 

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