Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / March 2008

Tip: Looking for answers? Try searching our database.

Report Grand totals problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ToniS - 19 Mar 2008 22:37 GMT
I have a report with a a few subreports.  One sub report has the total fees
for an Exhibitor My problem is with in the Report Footer section the grand
totals display correctly but when the report is printed to a printer, the
grand total section is not correct.  Below is what I have

More details on the problem: For example if the user is on the last page of
the report the total section was doubled. I then added the GrandTotalFees = 0
part and that fixed that problem.  If the user is on the first page and
prints the report to a printer the total section on the last page is off by
the total amount that is on the first page (page 1 total fees is 150, Grand
total Should be 400 but prints 550).

When I click on the printer icon to print it goes through the Detail_Format
section agaain, I think I need to clear my grand totals but not sure which
event to do so..

Any ideas what I need to do?
Thanks
ToniS

Option Compare Database
Option Explicit

Public GrandTotalFees As Currency
Public GrandTotalPaid As Currency
Public GrandTotalBalance As Currency

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

   ' Calculate Grand Total line (end of report)
   GrandTotalFees = GrandTotalFees + Nz([Report].[TxtSummaryTotalFees])
   GrandTotalPaid = GrandTotalPaid + Nz([Report].[TxtSummaryTotalPaid])
GrandTotalBalance = GrandTotalBalance + Nz([Report].[TxtSummaryTotalBalance])
   
End Sub

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
 
   ' Print Grand Total line (end of report)
   Report_FeeTotals.TxtGrandTotalFees.Value = GrandTotalFees
   Report_FeeTotals.TxtGrandTotalPaid.Value = GrandTotalPaid
   Report_FeeTotals.TxtGrandTotalBalance.Value = GrandTotalBalance

   GrandTotalFees = 0
   GrandTotalPaid = 0
   GrandTotalBalance = 0
   
End Sub
Marshall Barton - 20 Mar 2008 00:43 GMT
>I have a report with a a few subreports.  One sub report has the total fees
>for an Exhibitor My problem is with in the Report Footer section the grand
[quoted text clipped - 11 lines]
>section agaain, I think I need to clear my grand totals but not sure which
>event to do so..

[snip a bunch of code that can not work]

You can not use code in event procedure to calculate a
result composed of values from more than the current record.
As you have seen, Access processes sections in whatever
order and however many times are necessary to format the
report.  For example, think about what happens when a
KeepTogether section or group does not fit in its initial
location.

There are two features that can be used to calculate a grand
total.  The easiest is to use a report (or group) footer
section text box with an expression like:
    =Sum(<expression containing only record source fields>)
For example, an invoice total might be calculated by the
expression:
    =Sum(Price * Quantity)

The other way is to use a running sum text box in the detail
section.  You can calulate your grand total fees by adding
an invisible text box named txtRunTotalFees.  Set its
control source expression to:
    =TxtSummaryTotalFees
and its RunningSum property to Over All
Then the report footer text box can display the grand total
by using the expression:
    =txtRunTotalFees

Signature

Marsh
MVP [MS Access]

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.