Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with conditional macro to print or hide footer 1

Status
Not open for further replies.

kendue

IS-IT--Management
Jul 13, 2009
30
US
I am printing customer statements as an Access report with aging and a Total Due at the end of each customer's statement. If the statement uses more than a single page, I would like for the aging and total to appear in the page footer (not customer footer) of ONLY the last page for that customer, NOT on each page.

From what I can determine, I should be able to turn off the visibility of the page footer with a macro when proper conditions are met, but I don't know how to set up the wording and conditional phrasing to format the macro.

Can anyone help?
 
Do you print multiple customer statements in one report printout? If you print only one customer at a time, you could use code in the On Format event of the Page Footer to cancel the printing if Me.Page <> Me.Pages.

Do you understand non-last pages will still have a blank space where the page footer should be?

If you print multiple customers, you will need to find out if the current page is the last page for any particular customer.

Have you figured out how to get the aging and Total Due into a page footer?

Duane
Hook'D on Access
MS Access MVP
 
dhookom,

Yes, the statement report is a multi-customer report of over 200 customers. I currently have the aging and Total Due showing in the footer at the bottom of each page. Fortunately, most of the customer statements are only one page, so the footer prints properly on all those statements.

My less than elegant fix for the multi-page statements is to physically cut off the unwanted footer on the pages prior to the last page of a multi-page statement. I would like for the Access report to perform this deletion for me.

Thanks for your help.
 
Assuming you are breaking the page on each new customer, try:

Add a text box to the detail section of your report
Name: txtCustCountDetail
Control Source: =1
Running Sum: Over Group
Visible: No

Add code to the On Format event of the Page Footer Section:
Code:
Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
    Cancel = Me.txtCustCountDetail > 0
End Sub


Duane
Hook'D on Access
MS Access MVP
 
dhookom,

This fix works perfectly! Thank you so much for the help... this was fast and easy to implement, and does exactly what I was looking to accomplish.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top