How to summarize total in report ?

  • Thread starter Thread starter Malee
  • Start date Start date
M

Malee

Hello all experts,

I create a report with total line as the last line of report. I design
program to summarize total values by code because they are generated from
complex function. As unexpected result,

Total values always double. I tried both summarize values in Detail_Format
and Detail_Print event within condition of IF FormatCount = 1 / IF
PrintCount = 1. But it does not help,

Result still double. Earlily, I think I can protect code to be executed
twice (or more) by checking FormatCount (or PrintCount) argument, But It
look like that I wrong. :-(

Question is :
- Could I summarize value by code ? Or I should not do that !!!
- What are traditional methods to do that ?

Any help, Appreciate so much.
Malee
 
Malee said:
I create a report with total line as the last line of report. I design
program to summarize total values by code because they are generated from
complex function. As unexpected result,

Total values always double. I tried both summarize values in Detail_Format
and Detail_Print event within condition of IF FormatCount = 1 / IF
PrintCount = 1. But it does not help,

Result still double. Earlily, I think I can protect code to be executed
twice (or more) by checking FormatCount (or PrintCount) argument, But It
look like that I wrong. :-(

Question is :
- Could I summarize value by code ? Or I should not do that !!!
- What are traditional methods to do that ?


You're asking exactly the right questions. Most people want
to know how to make that kind of code work properly, but,
because records/sections are processed in whatever order is
necessary to format (KeepTogether, Pages, etc) the report,
there is no way that VBA code in event procedures can be
used to accumulate a result based on multiple records.

There are two alternatives, one is the obvious route of
using a totals query as the record source of a subreport.
The other is to use one or more text boxes with their
RunningSum property set to Over Group or Over All.
 
Back
Top