Report/Page Footer

T

Tye Graham

I have a report that needs to have some information at the bottom of
the last page of the report. I put in the following code to the Page
Header Format:

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
If Me.Pages > 0 Then
Me.Section(4).Visible = (Me.Page = Me.Pages)
Else
Me.Section(4).Visible = False
End If
End Sub

It works beautifully on a one page report and on a multiple page
report. Except for one situation. When the report is just short
enough that not printing the page footer would make the report 1 page.
It then doesn't print the page footer and I'm stuck with no footer,
because it doesn't print the next page. I added a control to tell me
how many pages there are in the report, and it says 2. I've been
scratching my head on this one. If the control's value is set to
=[Pages] and it shows 2, but I only get 1 page, I'm not sure where to
go from here.
 
M

Marshall Barton

Tye said:
I have a report that needs to have some information at the bottom of
the last page of the report. I put in the following code to the Page
Header Format:

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
If Me.Pages > 0 Then
Me.Section(4).Visible = (Me.Page = Me.Pages)
Else
Me.Section(4).Visible = False
End If
End Sub

It works beautifully on a one page report and on a multiple page
report. Except for one situation. When the report is just short
enough that not printing the page footer would make the report 1 page.
It then doesn't print the page footer and I'm stuck with no footer,
because it doesn't print the next page. I added a control to tell me
how many pages there are in the report, and it says 2. I've been
scratching my head on this one. If the control's value is set to
=[Pages] and it shows 2, but I only get 1 page, I'm not sure where to
go from here.


That's a catch 22, or in programmer speak an infinite loop.
If it fits on one page without the footer, then put in the
footer so it doesn't fit, but when it doesn't fit remove the
footer so now it does fit.

How about leaving the page footer visible but make it's
controls invisible except on the last page. This way the
space occupied by the page footer will be consistent on all
pages and the Pages property won't get confused.
 

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