Adding Subreport totals to Main Report to get Grand Total

  • Thread starter Thread starter ejike_discuss
  • Start date Start date
E

ejike_discuss

hi
I have created a Report that has totals and within it is a Subreport
that has its own total.
What i want to do now is to add these two sets of totals together to
create a Grand Total but i really do not know how to go about it.

Ive been told that i can use shared variables to do this but ive never
used them before and so do not know how to go about creating them.

Can anyone help this newbie?
 
In your subreport, place an unbound calculated control in the report footer that sums
up the subform value. (ex. =Sum(Something)), and call it SubTotalSomething.
On your Main report do the same for it's value (ex. Sum(Something)) and call it
MainTotalSomething.
Now add them together on the main ...

= MainTotalSomething +
Reports!rptYourMainReportName!rptYourSubformName.Report!SubTotalSomething
 
It would help if you provided control names. However, try something on your
main report like:
=txtMainReportControlName + subrptCtrlName.Report!txtOnSubrpt
 
hi Al

Ive tried what you suggested but now i get two error messages on my
visiostudio report.

the first is 'The value expression for the text box 'textbox18'
contains an error [BC30451] Name Subreport is not declared'

the second is 'The value expression for the text box 'textbox34 '
contains an error [BC30451] Name MainTotalM1 is not declared'
 
hi Duane

Tried out what you suggested but this hasnt worked either.

Perhaps if i gave you more info this may help.

On my Subjective Report I have 12 values for each month of the year.
For the first month the value is =sum(Fields! Month_1.Value), and I
have named this text box 'SubRepM1'
The name of the subreport is 'subreport1'.

On my Main Report, again I have 12 values for each month of the year.
For the first month the value is =sum(Fields! Month_1.Value)*-1, and I
have named this text box 'MainRepM1'
The name of the main report is 'GMSHA Budget Adjustment Differentials'

So basically im trying to add up each Month value on the subreport and
main report to provide grand total on the main report.

In the last email you said it would help if I had control names. What
are these and how would i use them.

hope this helps
 
"control names" are what you provided. A text box is a control and it has a
name. You provided the names of your text boxes (controls). Assuming a
subreport named "subreport1" with a text box on it named "SubRepM1", if you
want to reference this value in your main report, add a text box in the same
section of your main report and set its control source to:
=subreport1.Report.SubRepM1
This will work as long as subreport1 returns records.
 
hi Duane

Thanks for explaining about control names.

However, I did as you suggested but the visual studio report now shows
the message
'The value expression for the text box 'textbox18'
contains an error [BC30451] Name subreport1 is not declared'

Do i need to declare the report and if so, do you know how i do this.

thankx
 
"visual studio report"? This is a Microsoft Access news group. I would only
expect to see questions regarding MS Access Reports.
 
Back
Top