Printing on Page Footer.

G

Guest

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
 
F

fredg

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

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.
 
F

fredg

Thanks Fred,
I took the first method and it just does what I was after plus gave some
understanding.

Now the next thing is how do I format the size of the page footer at runtime
because at every page before the last page, there is an empty space at the
bottom of the page where the page footer details gets printed on the last
page with the above setting supposed to sit on every page.

I am thinking that there must be a way like say...
If [page] = [pages] Then
Pagefooter size = some Value or dimension
Else
Pagefooter size = some Other Value or Other Dimension
End If

The above is just a thought and I don't know if that is logical and can be
done.

Thanks for any thoughts


Please always include the relevant portion of any previous message.

Also, this is really a new thread. It should not be piggy-backed onto
a previous thread. It is better for you, as someone who has no
interest in answering your previous subject might answer this subject.

Sorry, the Page Footer doesn't work that way. It's size is fixed in
Design View. It cannot shrink nor grow while the report is running.

I suggest you either place your data in columns in the Page Footer to
make the footer height smaller, or re-think what it is you are doing.
Perhaps you can place the controls in a new top level group footer and
size the footer as needed. As any other group would be within this
group, these controls will only print on the last page. I haven't had
to do it, but it should work.
 
Top