How do I prevent Report Footer "widows"?

Blake

Registered User.
Local time
Today, 01:23
Joined
Aug 28, 2002
Messages
21
Depending on the number of detail records, my report's footer winds up all by itself on the report's last page. That's aesthetically nasty, especially if the footer contains totals. What's the best way to handle this problem?

Regards, Blake
 
I gather you're referring to an item in the Microsoft Knowledge Base? I can't find an article with that number.
 
I suspect Microsoft has removed most of the useful stuff,
The following example demonstrates a method that compares the Page and the
Pages properties to determine if the current page is the last page of the
report, and if so, makes the information in the page footer visible.

1. Create a new report and place the following label control in the
report's page footer section:

Label:
Name: ReportFooterText
Caption: This is the last page
Visible: No

2. Create the following text box control in the page footer section:

Text Box:
Name: PageNumber
ControlSource: =[Page] & " of " & [Pages]

3. Set the page footer's OnPrint property to the following event
procedure:

Sub PageFooter2_Print (Cancel As Integer, PrintCount As Integer)

If Me.page = Me.pages Then
ReportFooterText.visible = True
Else
ReportFooterText.visible = False
End If
End Sub



Copyright (c) Microsoft Corporation. All rights reserved.
 
I really appreciate the feedback.

I've looked at the suggested code, but I don't see how it solves the problem. The failing is probably all mine: inadequate explanation of problem &/or inadequate understanding of the code.

The suggested code will apparently enable me to tell if I'm on the last page of the report. But by then it's too late since all the detail will have been printed on the previous page(s) and there'll be nothing left but the report footer (containing totals for various detail columns) to print on the last page. It's that last page dangling footer (widow? orphan?) that I want to avoid. I suppose I could include an invisible counter in the detail section, count the detail lines, and force an early page break on the penultimate page if I determine that the number of detail lines on the penultimate page equals the maximum number of detail lines required to bump the report footer to the next page; then somehow force one or two detail lines from the penultimate page to the last page so they'll appear with the footer. But, that's a lot of work and strikes me as sub-optimal since different printers or printer settings may affect the number of detail lines per page.

In summary, what I want is at least one detail line on the last page, namely the page on which the report footer appears.
 
The code is actually a work around, you remove the fields from the report footer and place them into the Page footer, the code will then take care of the rest
 
I finally get it. When combined with the page footer totalling technique explained in Q132017 I get what I want. But, it comes at a price. If there aren't many detail records, I wind up with a lot of white space between the last detail record and the totals in the page footer. A report footer positions the totals nicely adjacent the last detail line, but only if the report footer isn't bumped to the next page. I'll ponder whether a judicious combination of both page & report footers might yield the best of both worlds.

Thanks again for the helpful feedback.
 

Users who are viewing this thread

Back
Top Bottom