Summing from a Subreport

E

el zorro

My report lists customer records, some of which submit a
varying number of payments of diferent types. My report
shows the record for each customer, and uses a subreport
to list the individual payments. The subreport also sums
the payments for each customer.

I want to group the customers by Region, and show the
total customer payments for each Region. So I set up a
group footer for Region, and stuck in a Sum functiion:
=Sum([Payment Totals]). THis doesn't seem to be working.
Payment Totals is itself a sum from a subreport... if
that has anything to do woth it. Any thoughts?
 
M

Marshall Barton

el said:
My report lists customer records, some of which submit a
varying number of payments of diferent types. My report
shows the record for each customer, and uses a subreport
to list the individual payments. The subreport also sums
the payments for each customer.

I want to group the customers by Region, and show the
total customer payments for each Region. So I set up a
group footer for Region, and stuck in a Sum functiion:
=Sum([Payment Totals]). THis doesn't seem to be working.
Payment Totals is itself a sum from a subreport... if
that has anything to do woth it. Any thoughts?


Add a text box named txtRegionRunTotal in the same section
as the subreport. Set its expression to something like:

=IIf(subreport.Report.HasData, subreport.Report.total, 0)

Also set the text box's RunningSum property to Over Group.

Now the region footer's total text box can use the
expression:

=txtRegionRunTotal
 
G

Guest

THanks for your response. Can you tell me a little more
about the ".HasData" part? I don't think I'm using the
right syntax or something (I cant get the IIf statement
to work).
-----Original Message-----
el said:
My report lists customer records, some of which submit a
varying number of payments of diferent types. My report
shows the record for each customer, and uses a subreport
to list the individual payments. The subreport also sums
the payments for each customer.

I want to group the customers by Region, and show the
total customer payments for each Region. So I set up a
group footer for Region, and stuck in a Sum functiion:
=Sum([Payment Totals]). THis doesn't seem to be working.
Payment Totals is itself a sum from a subreport... if
that has anything to do woth it. Any thoughts?


Add a text box named txtRegionRunTotal in the same section
as the subreport. Set its expression to something like:

=IIf(subreport.Report.HasData, subreport.Report.total, 0)

Also set the text box's RunningSum property to Over Group.

Now the region footer's total text box can use the
expression:

=txtRegionRunTotal
 
M

Marshall Barton

=IIf(subreport.Report.HasData, subreport.Report.total, 0)

where:
"subreport" is the name of the subreport ***control*** on
the main report. Note that this may be differrent from the
name of the report object it is displaying.

"total" is the name of the text box in the subreport's
footer with the calculated total.

The HasData property will be True if the subreport has at
least one data record, it will be False if the subreport's
dataset is empty.
--
Marsh
MVP [MS Access]



THanks for your response. Can you tell me a little more
about the ".HasData" part? I don't think I'm using the
right syntax or something (I cant get the IIf statement
to work).
-----Original Message-----
el said:
My report lists customer records, some of which submit a
varying number of payments of diferent types. My report
shows the record for each customer, and uses a subreport
to list the individual payments. The subreport also sums
the payments for each customer.

I want to group the customers by Region, and show the
total customer payments for each Region. So I set up a
group footer for Region, and stuck in a Sum functiion:
=Sum([Payment Totals]). THis doesn't seem to be working.
Payment Totals is itself a sum from a subreport... if
that has anything to do woth it. Any thoughts?


Add a text box named txtRegionRunTotal in the same section
as the subreport. Set its expression to something like:

=IIf(subreport.Report.HasData, subreport.Report.total, 0)

Also set the text box's RunningSum property to Over Group.

Now the region footer's total text box can use the
expression:

=txtRegionRunTotal
 

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