Computer Learning Zone CLZ Access Excel Word Windows

What sculpture is to a block of marble, education is to the human soul.

-Joseph Addison
 
Home   Courses   Seminars   Templates   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Access >
TechHelp


Back to TechHelp
 

Print Invoice Totals at Bottom Upload Images   Link  
Edward Mastoloni 
7 months ago
I have an invoice print that uses a sub-report for the invoice details.  I created a text box in in the Report Footer section with following control source =[SalesInvoiceLineSubreport].[Report]![TotalAmount].  That works fine but I want it to print at THE bottom of the page along with some text that is contained within Labels (ie standard text about late charges and other legal stuff).

I tried moving all of that to the Page Footer Section and that worked great, however, if the invoice details ran past the end of page 1 to page 2, the Invoice total and labels print at the bottom of both page 1 and 2.  Any ideas how I can get everything (Invoice total and legal mumbo jumbo) on the bottom of the LAST page ONLY
Kevin Yip
7 months ago
In your subreport you need to do a VBA trick.  Check if the last record of the subreport has just been printed.  If not, set the main report's footer to blank.  If yes, set the footer's value.  In your subreport's Detail_Format event, write something like this:

     Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
         Parent!footerinfo = IIf(Me!somefield = ValueInLastRecord, "Footer to be printed", "")
     End Sub

"Parent" is an Access keyword that refers to the parent object of the subreport, which is the main report in this case.  "footinfo" is the name of your main report's footer control.

"somefield" is a field on your subreport, could be an ID, invoice#, whatever.  It needs to be something that can help you locate the last record of the subreport.  If you choose "invoice date" as the field, but all records have the same invoice date, then naturally it won't help you.  I suggest you choose a unique index field such as the primary key.  Use the MoveLast command on your subreport's Recordset to check what value it has in the last record.
Edward Mastoloni
7 months ago
What does "Footer to be printed" mean?
The control name of my report footer is "ReportFooter"
Edward Mastoloni
7 months ago

Kevin Yip
7 months ago
"Footer to be printed" is just a placeholder for whatever you want to print or not want to print in your footer section.  

"ReportFooter" is *not* your footer's control name.  The names of those textboxes in the footer section are.  Let me rewrite my code in the nomenclature you can relate to:


     Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
         Parent!TextboxNameInYourFooter = IIf(Me!somefield = ValueInLastRecord, PutYourSubformTotalHere, "")
     End Sub
Edward Mastoloni
7 months ago
Got it!  Thanks so much

This thread is now closed. If you wish to comment, start a NEW discussion, below.
 


Back to TechHelp Comments
 

Start a NEW Conversation
 
Only students may post on this page. Click here for more information on how you can set up an account. If you are a student, please Log On first. Non-students may only post in the Visitor Forum.
 
Subscribe
Subscribe to TechHelp
Get notifications when this page is updated
 
 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard

Blog RSS Feed    Twitter

YouTube Channel    LinkedIn
Copyright 2023 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/3/2023 11:50:33 PM.