How to get SubReport Total to show on Main Report?

  • Thread starter Thread starter MikeB
  • Start date Start date
M

MikeB

I have not been able to figure this out. I have a main report with a
sub-report in it.
The sub-report has a field called Text84, that is the Sum of a field called
"dctrip-dollars", looks like this to get the total on the Sub-Report,
=Sum([dctrip-dollars]).

I want to be able to move the Text84 total to the maim report where I do
other calculations. I tried to get the total with this statement,

=([Reports]![STrptStatement20022003]![Text84])

Does not work. Give me an Error message.

Any ideas on what I have done wrong, and how to fix it.

Thanks for the help,
MikeB
 
Subreports are not open in their own right, i.e. they are not part of the
Reports collection.

Try:
=[STrptStatement20022003].[Report]![Text84])
where "STrptStatement20022003" is name of the subreport *control* on your
main report.

If the subreport has no data, that reference will give you an error, which
will mess up your calculations. Once you get the above working, test the
HasData property of report in the subreport control, and also use Nz() to
convert any null to zero:

=IIf([STrptStatement20022003].[Report].HasData,
Nz([STrptStatement20022003].[Report]!Text84,0), 0)
 
Allen,

Thanks very much, this worked great. The Access NewsGroups and all who
monitor have been so very helpful to me, I can't thank you enough. I have a
number of books on Access in various versions, and when I can't find the
answer there, the News Groups always come through. I have learned a lot
just by watching others postings.

Again, thanks very much.

MikeB

~~~~~~~~~~~~~~~~~~~~~~~~~



Allen Browne said:
Subreports are not open in their own right, i.e. they are not part of the
Reports collection.

Try:
=[STrptStatement20022003].[Report]![Text84])
where "STrptStatement20022003" is name of the subreport *control* on your
main report.

If the subreport has no data, that reference will give you an error, which
will mess up your calculations. Once you get the above working, test the
HasData property of report in the subreport control, and also use Nz() to
convert any null to zero:

=IIf([STrptStatement20022003].[Report].HasData,
Nz([STrptStatement20022003].[Report]!Text84,0), 0)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

MikeB said:
I have not been able to figure this out. I have a main report with a
sub-report in it.
The sub-report has a field called Text84, that is the Sum of a field called
"dctrip-dollars", looks like this to get the total on the Sub-Report,
=Sum([dctrip-dollars]).

I want to be able to move the Text84 total to the maim report where I do
other calculations. I tried to get the total with this statement,

=([Reports]![STrptStatement20022003]![Text84])

Does not work. Give me an Error message.

Any ideas on what I have done wrong, and how to fix it.

Thanks for the help,
MikeB
 
Excellent, Mike. Appreciated.

Most of us would echo your sentiments. What we have learned here from
everyone's real-world struggles and solutions is invaluable.
 
Back
Top