I have separate Access reports that I want viewed as one when printed. Each
report has varies in length. Is there a way to have consecutive page
numbers for the entire print job as a whole, even though it consists of
separate reports?
Make a table to hold the last page number of each report.
Table name "tblPage"
All you need is one field:
"intPageNumber" Number datatype, Integer
Next, enter a 0 (Zero) into the field as a starter number.
Now in each report, Dim a variable in the declarations section:
Option Compare Database
Option Explicit
Dim intLastPage as Integer
Code each report's Open event:
intLastPage = DLookUp("intPageNumber","tblPage")
Code each Report's Report Header Format event:
[Page] = [Page] + intLastPage
Code each Report's Report Footer Print event:
DoCmd.SetWarnings False
DoCmd.RunSQL "Update tblPage Set tblPage.intPageNumber = " & [Page] &
";"
Docmd.SetWarnings True
Each report should pick up the ending page of the previous report and
increment it by 1.
Note: You'll not be able to use the [Pages] property in any of these
reports, i.e. ="Page " & [Page] & " of " & [Pages] as you'll get
something
like "Page 32 of 4".
You must enter a 0 in the table at the start of each batch of reports.
If there is always one same report which is run first in the batch,
just use a RunSQL in the first Report's Open event (before anything
else):
DoCmd.SetWarnings False
DoCmd.RunSQL "Update tblPage Set tblPage.intPageNumber = 0;"
Docmd.SetWarnings True
to reset the field to zero.
If the Reports are in run in random order, manually (or otherwise)
enter a 0 into that table field before starting.