jo*********@gmail.com wrote:
>I'm having trouble continuously page numbering a large report in MS
Access. The report is made up of three separate Access reports which I
join together at the end.
In the past I have opened the reports and viewed them to see how long
they are then go in and manually type the page number and total page
number.
I am aware of the [page] and [pages] lines of code but this resets with
each new report.
I am also aware that Access runs the report once to calculate the
[pages] number then runs it again to print the number.
I was thinking of maybe 2 options:
1. Run the reports once (using VB to open them) and somehow dump down
the [pages] figure to a temporary table. Then run the reports again (or
a copy of the reports with alter page numbering code) using the figures
from the temporary table to get a total
2. Set a PageCounter.Value = 1 (in VB) on the first report and use it
to count through the pages. When the next report starts it will have
kept the total number from the last report.
Joel wrote in private email:
I've got it to report how many pages are in the first report
in a text box in my form and can easily input this into my
report. I'll run the reports twice to input the 3 reports
total page numbers.
One thing, I'm only new to Access and VB (ie 1 weeks
practice) How do I open and close a report or activate and
deactivate a report. Currently I've used the below code:
Dim grppages As Integer
grppages = 0
DoCmd.OpenReport "customer", acViewPreview
grppages = Reports!customer.Pages
Me.Text4.Value = grppages
I know you mentioned having to checking if the report has
been closed inorder to open the next report but I can't seem
to figure out how to close it.
-------------------------------------------------------------------------
Please keep the correspondence in the news groups where
others can contribute alternate approaches and refinements
and where everyone can benefit from the exchange of ideas.
OTOH, private email consulting is reserved for paying
clients.
The approach I suggested did not require you to run the
reports twice. The form's code can **PRINT** the first
report, which calculates its Pages value. When that report
closes, it uses its Close event to same its Pages value back
to the form text box using code like I posted earlier. The
form then prints the second report and so on. This approach
requires minimal modifications to the reports, but it is not
particularly useful for previewing.
A different appraoch is to use an unbound main report that
only has your three reports as subreports. This way, the
page nunbering is in the main report and no longer an issue.
However, page related items are ignored in subreports so if
you rely on the Page event, or heade/ footer sections, you
will have to make some potentially significant changes to
the three reports.
--
Marsh