Date Parameter in Sub Reports

R

Rose

If you have multiple sub reports derived from multiple queries that all ask
for a data parameter. Is there a way to enter this once for all of them
instead of multiple times?
 
F

fredg

If you have multiple sub reports derived from multiple queries that all ask
for a data parameter. Is there a way to enter this once for all of them
instead of multiple times?

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 then report will run.
When the report closes, it will close the form.
You will no longer be prompted for the dates.
 
R

Rose

Thank You
--
Rose


fredg said:
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 then report will run.
When the report closes, it will close the form.
You will no longer be prompted for the dates.
 

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