Control record number for page to page

  • Thread starter Thread starter YC
  • Start date Start date
Y

YC

There are not much discussion on printing of report
having different layout for different pages. I would like
to find out more on this, and hope you can help.

I've created 2 reports for a single printing button
because the layout of the 2 pages are different. One
report for the 1st page the other report for the rest of
the pages. How can I control printing of the records in
the 2 report? (for example if 1st page have printed
records 1 to 10, the 2nd report should print from record
11 to the rest) My "detail section" in the reports are
set to CanGlow, therefore the number of records in the
reports are not a fix number.

Thanks a lot
 
YC said:
There are not much discussion on printing of report
having different layout for different pages. I would like
to find out more on this, and hope you can help.

I've created 2 reports for a single printing button
because the layout of the 2 pages are different. One
report for the 1st page the other report for the rest of
the pages. How can I control printing of the records in
the 2 report? (for example if 1st page have printed
records 1 to 10, the 2nd report should print from record
11 to the rest) My "detail section" in the reports are
set to CanGlow, therefore the number of records in the
reports are not a fix number.

Thanks a lot
You'll need to have code in both reports.

First, make a new table to hold the last page number of the first
report.
Table name: "tblPage"
Field Name: "intPageNumber" Number datatype, Integer
Enter a 0 as the first record value.

Next, open the first report in design view.

Next, you'll enter a 0 (Zero) into the table field to reset any
previously existing value to 0.
Code the Report's Open event:

CurrentDb.Execute "Update tblPage Set tblPage.intPageNumber = 0;",
dbFailOnError

Then.... code the Report's Report Footer Print event:

CurrentDb:Execute "Update tblPage Set tblPage.intPageNumber = " & [Page]
& ";", dbFailOnError


Now open the second report in design view,
and Dim a variable in the declarations section:

Option Compare Database
Option Explicit
Dim intLastPage as Integer

Code the report's Open event:
intLastPage = DLookUp("intPageNumber","tblPage")

Code the Report's Report Header Format event:
[Page] = [Page] + intLastPage


The second 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".
 
Back
Top