Sum values from subreport to groups

N

News

I have a report that shows work orders completed by department (group total)
and by hospital (grand total). The detail section shows the work order
information with 2 subreports work order hours and parts cost. The 2
subreports show the total hours and total parts cost for that work order,
and that data is then copied to the main form (still in the detail section).
I used the functions shown in method 3 of Microsoft article Q208850,
ACC2000: How to Sum a Calculation in a Report .

The work order values display correctly for each work order, the group
totals by department, and grand total by hospital display properly - BUT
ONLY when I navigate through the report print preview one page at a time.
If I jump right to the last page for the totals or print the report, the
group and grand totals are 0.

Any idea what would cause the values to display ONLY when print preview is
cycled through, rather that when the report is printed directly?

Thanks!

-Richard
 
A

Allen Browne

Method 3 in that article is flawed. It relies on the events to calculate the
totals, and the events may not occur for all pages if you print or preview
only some pages.

Use the Running Sum approach instead.
 
M

Marshall Barton

News said:
I have a report that shows work orders completed by department (group total)
and by hospital (grand total). The detail section shows the work order
information with 2 subreports work order hours and parts cost. The 2
subreports show the total hours and total parts cost for that work order,
and that data is then copied to the main form (still in the detail section).
I used the functions shown in method 3 of Microsoft article Q208850,
ACC2000: How to Sum a Calculation in a Report .

The work order values display correctly for each work order, the group
totals by department, and grand total by hospital display properly - BUT
ONLY when I navigate through the report print preview one page at a time.
If I jump right to the last page for the totals or print the report, the
group and grand totals are 0.

Any idea what would cause the values to display ONLY when print preview is
cycled through, rather that when the report is printed directly?


Please excuse the inexperience of that article's author.
You can not reliably use VBA in event procedures to
calculate a total. The event proedures can be executed
multiple times, are not always processed sequentially or, in
you case, not executed at all.

Use running sum text boxes instead of all that useless code.
 
R

Richard Overturf

Unless I am mistaken, the problem with using the running sum method is that
it will display the accumulated totals for each group, and I need to show
the individual department group total on the report, group by group, with
the grand total at the end of the report.
 
M

Marshall Barton

RunningSum has two options, Over Group and Over All.

For the group total, use a text box with it set to Over
Group. For the grand total, use another text box with it
set to Over All.
 
R

Richard Overturf

Marsh,

Thanks, but I found a better way. I went back to my report's record source
and added the parts total by work order there, so that the main report has a
valid data field to work with, not a reference to a data field on the
subreport.

Thanks!

Marshall Barton said:
RunningSum has two options, Over Group and Over All.

For the group total, use a text box with it set to Over
Group. For the grand total, use another text box with it
set to Over All.
--
Marsh
MVP [MS Access]



Richard said:
Unless I am mistaken, the problem with using the running sum method is
that
it will display the accumulated totals for each group, and I need to show
the individual department group total on the report, group by group, with
the grand total at the end of the report.
 

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