I have a report that I am forcing the labels, frames, textboxes etc to be
printed on at the bottom of the last page of the report.
The code below does just that (ie all objects have their visibility turned
to false to start by default but turned to true if the current page equals
the total number of pages in the report) and all looks fine when I preview
the report but when I print the report, it somehow prints the page footer
contents on every page.
Does anyone one know how I could get it to print only on the last page?
Here is the code on the OnFormat property of the Page Footer.
Private Sub PageFooterSection_Print(Cancel As Integer, PrintCount As Integer)
If [Page] = [Pages] Then
'[PageFooterControlName1] = [ReportFooterControlName1]
Me.txtAmountOwing.Visible = True
Me.txtAmountPaid.Visible = True
Me.txtBankDetails.Visible = True
Me.txtCharges.Visible = True
Me.txtCratesPallets.Visible = True
Me.txtDeliveryTotal.Visible = True
Me.txtGrandTotal.Visible = True
Me.txtGrowerName.Visible = True
Me.txtInvoiceDate.Visible = True
Me.txtSubtotal.Visible = True
Me.txtCratesTotal.Visible = True
Me.txtPalletsTotal.Visible = True
'[txtDiscountTotal] = [txtDiscount]
Me.txtDiscountTotal.Visible = True
Me.lneAmountPaid.Visible = True
Me.lneDashedLine.Visible = True
Me.lneTotalBottom.Visible = True
Me.lneTotalTop.Visible = True
Me.lneTop.Visible = True
Me.lblPleaseDetach.Visible = True
Me.lblReturnAddress.Visible = True
Me.lblPleasePay.Visible = True
Me.fraCreatesAndPallets.Visible = True
Me.fraTotals.Visible = True
Me.gst.Visible = True
End If
End Sub

Signature
niuginikiwi
Nelson, New Zealand
fredg - 17 Jan 2007 04:44 GMT
> I have a report that I am forcing the labels, frames, textboxes etc to be
> printed on at the bottom of the last page of the report.
[quoted text clipped - 38 lines]
> End If
> End Sub
That's because once the formatting has been done for Preview, all the
controls in the footer have been made visible.
You need to toggle visible on whether or not it is the last page.
The following 2 methods should work.
1) Place your code in the Page Footer Format event.
Code the Page Footer Format event:
If [Page] = [Pages] Then
Me.txtAmountOwing.Visible = True
Me.txtAmountPaid.Visible = True
Me.txtBankDetails.Visible = True
`etc....
Else
Me.txtAmountOwing.Visible = False
Me.txtAmountPaid.Visible = False
Me.txtBankDetails.Visible = False
etc....
End If
2) Are these the ONLY controls in the Page Footer?
You only wish the Page Footer to print on the last page?
If so, in Design View, make all of the controls Visible by default.
Then code the Page Footer Format event:
Cancel = Not ([Page] = [Pages])
Much cleaner and the result should be the same.

Signature
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail