By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,208 Members | 1,072 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,208 IT Pros & Developers. It's quick & easy.

Continuous Page Numbering for Multiple Reports

P: n/a
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.

If anyone has any idea how to do this help would be appreciated.

Jan 5 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Try this. For the first report, getting the page number on the OnFormat event
of the page header, and placing it in a global variable if it is larger
previously found (Access may format pages in a strange order.) For the second
report have a field set to the page number plus the global variable.

And so on.

Hope this helps some.

Gary

<jo*********@gmail.comwrote in message
news:11**********************@s34g2000cwa.googlegr oups.com...
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.

If anyone has any idea how to do this help would be appreciated.

Jan 5 '07 #2

P: n/a
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.

If anyone has any idea how to do this help would be appreciated.

Presumably you have a form that is opening the reports. If
so, use a text box on the form for each report to record its
Pages value. In the reports' Close event:

Forms!theform.thetextbox = Me.Pages

Set the text box value to 0 before starting the first
report, then each report can use expressions to display the
page and pages:
=(Page + Forms!theform.thetextbox) & " of " (Pages +
Forms!theform.thetextbox)

You need to use the IsLoaded method to check that the
previous report is closed before opening the next report.

--
Marsh
Jan 5 '07 #3

P: n/a
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
Jan 10 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.