SubReports Page Numbering

B

bw

I posted this yesterday (I thought), but it never showed up, so I'm trying again. I apologize
if it later appears twice...
----------------------------------------------------------------------------------------------------------------------------
I have a report "rptPBSMaster", that contains nothing but SubReports, and a footer
containing a page number.

"rptPBSub1" report is in the Report HEADER of rptPBSMaster and has a page number in
it's own footer.

"rptPBSub2" report is in the Report FOOTER of rptPBSMaster and it also has a page
number in it's own footer.

Currently, the "rptPBSMaster" prints exactly as I want, except that the page numbers are
continuous for both subreports.

How do I make sure that the Page Number of the "rptPBSub2" report always begins
anew with Page 1?

Thanks,
Bernie
 
S

SA

Bw:

Take the page numbers out of the sub reports. Apply the page number only to
the master report's page footer.
 
B

bw

Thanks for the response Steve, but I did what you said, which resulted in NO change to
my report. I have removed the page numbers from the sub reports. The master report
has a page number in the page footer.

Do you have any other suggestions?

Thanks,
Bernie
 
M

Marshall Barton

bw said:
I posted this yesterday (I thought), but it never showed up, so I'm trying again. I apologize
if it later appears twice...
----------------------------------------------------------------------------------------------------------------------------
I have a report "rptPBSMaster", that contains nothing but SubReports, and a footer
containing a page number.

"rptPBSub1" report is in the Report HEADER of rptPBSMaster and has a page number in
it's own footer.

"rptPBSub2" report is in the Report FOOTER of rptPBSMaster and it also has a page
number in it's own footer.

Currently, the "rptPBSMaster" prints exactly as I want, except that the page numbers are
continuous for both subreports.

How do I make sure that the Page Number of the "rptPBSub2" report always begins
anew with Page 1?

Page headers/footers are ignored in subreports so they have
no effect at all.

You can reset the page number in the main report's Report
Footer section's Format event:

Me.Page = 1
 
B

bw

Thanks Marsh, it ALMOST worked.

I put your code in the On Format event of the Report Footer like the following:

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
Me.Page = 1
End Sub

My first sub report has 10 pages, my second sub report has 3 pages.

The above code gave me 9 pages, and then the 10th page was numbered 1, along with
all subsequent pages of the second sub report.

I moved the above code to the On Print even of the Report Footer, and it gave me 10
pages correctly for the first sub report, but all 3 pages on the second sub report were
marked as page 1.

Can you guess at what I'm doing wrong?

Thanks,
Bernie
 
M

Marshall Barton

bw said:
Thanks Marsh, it ALMOST worked.

I put your code in the On Format event of the Report Footer like the following:

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
Me.Page = 1
End Sub

My first sub report has 10 pages, my second sub report has 3 pages.

The above code gave me 9 pages, and then the 10th page was numbered 1, along with
all subsequent pages of the second sub report.

You do not have the report header's ForceNewPage property
set to After Section, so the page number was reset before
the report footer got to the next page, but that's probably
irrelevant.

I didn't see where you were going to have multiple pages in
the main report's footer and you're right, the Format event
will reset the page number on each page of the footer
section.
I moved the above code to the On Print even of the Report Footer, and it gave me 10
pages correctly for the first sub report, but all 3 pages on the second sub report were
marked as page 1.

The Print event will also reset the the page number on each
page.
Can you guess at what I'm doing wrong?

You're not really doing anything wrong beyond following my
inadequate advice. What we have to do is find an event that
only fires once in the main report's footer section. I
don't like relying on the PrintCount argument of the Print
event, but it should work in the case:

If PrintCount = 1 Then
Me.Page = 1
End If

If that causes problems (maybe if you preview the report and
skip back and forth to the footer's first page), then you
could try the Format event again:

If FormatCount = 1 Then
Me.Page = 1
End If

Like I said, I don't like either of those ideas, but the
only other place I can think of is in the subreport's Open
event:

Me.Parent.Page = 1
 
B

bw

Oh, thank you, thank you, Sir!

I did have to set the ForceNewPage property to After Section as you suggested, and I
used PrintCount argument (FormatCount didn't work).

Everything seems to work now, and I learned something to boot.

Thanks again, Marsh...
Bernie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top