5 reports, asks for range printing each - can I stop that?

  • Thread starter Thread starter Sean
  • Start date Start date
S

Sean

Hi. Here is my current setup. I have a query that pulls
the range entered, then have a macro to print out 5
reports based on this one query. However when each report
prints, the reports themselves again ask for a range and I
need to re-enter. This gets tedious entering for all 5.
Is there a way to have the range selected, then print out
reports based on that range without yet again prompting
for a range?
Any help is appreciated.
Thanks.
 
Hi. Here is my current setup. I have a query that pulls
the range entered, then have a macro to print out 5
reports based on this one query. However when each report
prints, the reports themselves again ask for a range and I
need to re-enter. This gets tedious entering for all 5.
Is there a way to have the range selected, then print out
reports based on that range without yet again prompting
for a range?
Any help is appreciated.
Thanks.

You are using Macros.
I'll assume you do know how to write an event procedure.
Post back if you do not.

I'll also assume, that the 'Range entered' is a Date range.

Use a form to enter the parameter values.
Create a new unbound form.
Add 2 unbound text controls.
Name one "StartDate"
Name the other "EndDate"
Set each control's format property to a Date format.
Add a Command button to the form.
Code it's Click event:
Me.Visible = False
Name this form "ParamForm".

Change the query parameters from something like
Between [Start Date] and [End Date]
to:
Between forms!ParamForm!StartDate and forms!ParamForm!EndDate

Code each report's Open Event:
If Not IsLoaded("ParamForm") Then
DoCmd.OpenForm "ParamForm", , , , , acDialog
End If

If there is always one report that is the final one printed, code that
report's Close event:

DoCmd.Close acForm, "ParamForm"

Otherwise you'll need to manually close the form after the last report
has been printed.

When you start printing, the first report will open the ParamForm.
Enter the starting and ending dates.
Click the command button.

The Report will print. When the next report is run, since the form is
still open (though hidden), the parameters will be available to the
query and you will not be prompted again.

The last report will close the form (if you have coded it to do so).
 
Thanks for the reply. I have done some event procedures
but I am not fluent with the syntax and it may take me a
bit.
And the range is actually a number. Basically each
document has a number and I choose which range I want,
which then should print out the 5 reports which go to
different people.
This was someone elses database and he had this macro.
Since it asks for the range parameter constantly I think
it is redundant and want to fix it.
Thanks,
Sean
-----Original Message-----
Hi. Here is my current setup. I have a query that pulls
the range entered, then have a macro to print out 5
reports based on this one query. However when each report
prints, the reports themselves again ask for a range and I
need to re-enter. This gets tedious entering for all 5.
Is there a way to have the range selected, then print out
reports based on that range without yet again prompting
for a range?
Any help is appreciated.
Thanks.

You are using Macros.
I'll assume you do know how to write an event procedure.
Post back if you do not.

I'll also assume, that the 'Range entered' is a Date range.

Use a form to enter the parameter values.
Create a new unbound form.
Add 2 unbound text controls.
Name one "StartDate"
Name the other "EndDate"
Set each control's format property to a Date format.
Add a Command button to the form.
Code it's Click event:
Me.Visible = False
Name this form "ParamForm".

Change the query parameters from something like
Between [Start Date] and [End Date]
to:
Between forms!ParamForm!StartDate and forms!ParamForm! EndDate

Code each report's Open Event:
If Not IsLoaded("ParamForm") Then
DoCmd.OpenForm "ParamForm", , , , , acDialog
End If

If there is always one report that is the final one printed, code that
report's Close event:

DoCmd.Close acForm, "ParamForm"

Otherwise you'll need to manually close the form after the last report
has been printed.

When you start printing, the first report will open the ParamForm.
Enter the starting and ending dates.
Click the command button.

The Report will print. When the next report is run, since the form is
still open (though hidden), the parameters will be available to the
query and you will not be prompted again.

The last report will close the form (if you have coded it to do so).
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.
.
 
Thanks for the reply. I have done some event procedures
but I am not fluent with the syntax and it may take me a
bit.
And the range is actually a number. Basically each
document has a number and I choose which range I want,
which then should print out the 5 reports which go to
different people.
This was someone elses database and he had this macro.
Since it asks for the range parameter constantly I think
it is redundant and want to fix it.
Thanks,
Sean
Sean,
Everything stays the same as my previous post, just do NOT set the
Format property of the controls on the form to Date format.

As far as the property syntax needed ...
I gave you the proper syntax.

To place the code in the Report's Open event, display the report's
property sheet. Click on the Event tab.
On the On Open event line enter:
[Event Procedure]
Click on the button with the 3 dots that will appear on that line.
When the Code window opens, type the code I gave you between the 2
already existing lines for that procedure.
Exit the window.

Do the same for the Close event of that final report.
 
Fred,

Thanks. I understood the process of what was going as I
went through your directions. Doing always makes thing
easier to understand.
However I am getting a compile error on IsLoaded. Sub or
function not defined. I should have noted before it was
Access 2000 so maybe the syntax is different?
Thanks for all of you help.
Sean
-----Original Message-----
Thanks for the reply. I have done some event procedures
but I am not fluent with the syntax and it may take me a
bit.
And the range is actually a number. Basically each
document has a number and I choose which range I want,
which then should print out the 5 reports which go to
different people.
This was someone elses database and he had this macro.
Since it asks for the range parameter constantly I think
it is redundant and want to fix it.
Thanks,
Sean
Sean,
Everything stays the same as my previous post, just do NOT set the
Format property of the controls on the form to Date format.

As far as the property syntax needed ...
I gave you the proper syntax.

To place the code in the Report's Open event, display the report's
property sheet. Click on the Event tab.
On the On Open event line enter:
[Event Procedure]
Click on the button with the 3 dots that will appear on that line.
When the Code window opens, type the code I gave you between the 2
already existing lines for that procedure.
Exit the window.

Do the same for the Close event of that final report.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.
.
 
Thanks Fred. Some minor things still preventing it from
happening, buT I am playing around with it. The anonymous
reply is also myself and has more info. i just forget to
put in my name and info.
Sean
-----Original Message-----
Thanks for the reply. I have done some event procedures
but I am not fluent with the syntax and it may take me a
bit.
And the range is actually a number. Basically each
document has a number and I choose which range I want,
which then should print out the 5 reports which go to
different people.
This was someone elses database and he had this macro.
Since it asks for the range parameter constantly I think
it is redundant and want to fix it.
Thanks,
Sean
Sean,
Everything stays the same as my previous post, just do NOT set the
Format property of the controls on the form to Date format.

As far as the property syntax needed ...
I gave you the proper syntax.

To place the code in the Report's Open event, display the report's
property sheet. Click on the Event tab.
On the On Open event line enter:
[Event Procedure]
Click on the button with the 3 dots that will appear on that line.
When the Code window opens, type the code I gave you between the 2
already existing lines for that procedure.
Exit the window.

Do the same for the Close event of that final report.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.
.
 
Back
Top