detail section totals

M

mcnews

i am getting twice the expected total from my detail section
accumulators.
do access detail section loops execute twice?
what would explain this?

thanks,
mcnewsxp
 
M

Marshall Barton

mcnews said:
i am getting twice the expected total from my detail section
accumulators.
do access detail section loops execute twice?
what would explain this?


The sections in a report are processed as many times and in
whatever order is required to meet the report's design and
optimize report processing time.

That means that there is no reliable way to use event
procedures to calculate a value across multiple instances of
a section.

Instead, totals should be calculated in the report's record
source query or by using one or more text boxes with the
RunningSum property set as needed.
 
M

mcnews

The sections in a report are processed as many times and in
whatever order is required to meet the report's design and
optimize report processing time.

That means that there is no reliable way to use event
procedures to calculate a value across multiple instances of
a section.

Instead, totals should be calculated in the report's record
source query or by using one or more text boxes with the
RunningSum property set as needed.

--

good to know ...

can you point me to how to use running sums?
 
M

Marshall Barton

mcnews said:
can you point me to how to use running sums?


Search VBA Help for RunningSum Property.

Essentially you use a text box with an expression that
results in the value you want to sum. The RunningSum
property is set to indicate that you want Access to add the
value in each detail (or group header/footer). Then you can
use another text box in a group footer (Over Group) or the
report footer (Over All) with an expression that references
the running sum text box to display the total. This is
especially useful when the value you want to total is so
complex that it requires a user defined function to
calculate. In this kind of situation, the RunningSum text
box could use an expression like:
=MyFunction(fieldA, fieldB)

If the calculation is just a combination of some fields in
the report's record source table/query, you should use a
header/footer text box with an aggregate function (Count,
Sum, etc) instead of a RunningSum text box. E.g. an order
total might be the expression =Sum(Price * Quantity)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top