Calculating Total in Report Footer

M

Mary

Hi,

I'm trying to calculate a total in my report footer. The amount is coming
from a subreport included in the report. I created a new field in the
subreport called Text19 that calculates =Sum([Weight]). If I run the
subreport by itself it will do the subtotals correctly. I refer to this new
field in my report footer when I try to calculate the total.

If I use the following in my report footer:
=(srpt_MasterBillOfLading!text19) the report will run but the total will
come back 0 (zero).

If I use =sum(srpt_MasterBillOfLading!text19) the report will not run.
Instead it will ask for a Parameter Value. If I put a number in the
parameter value, this is the number that will be displayed on the report.

What am I be doing wrong?

Thanks,

Mary
 
T

tina

first, make sure you're using the *correct* name of the subreport control
within the main report. sometimes that's the same as the name of the
subreport object in the database window, but sometimes it's different. open
the main report in design view. click *once* on the subreport, within the
main report, to select it. in the Properties box, click on the Other tab.
look at the Name property.

once you have the correct name of the subreport control, try

=Sum(SubreportControlName.Report!text19)

hth
 
M

Mary

Hi there,

I did as you said... The subreport is called srpt_MasterBillOfLading...
That's what I already have, but I still used the copy function to copy the
name exactly and then I rewrote the report footer field code to
=Sum(srpt_MasterBillOfLading.Report!text19).

Same issue as before. It asks for a Parameter Value. If I remove "Sum" then
the report will run but with no total value.

So then I tried to change the Name of the subreport (in the property field
you mention below) to just Subreport... So now it's
=Sum(subreport.Report!text19) but still the same result.

Thanks!

Mary


tina said:
first, make sure you're using the *correct* name of the subreport control
within the main report. sometimes that's the same as the name of the
subreport object in the database window, but sometimes it's different. open
the main report in design view. click *once* on the subreport, within the
main report, to select it. in the Properties box, click on the Other tab.
look at the Name property.

once you have the correct name of the subreport control, try

=Sum(SubreportControlName.Report!text19)

hth


Mary said:
Hi,

I'm trying to calculate a total in my report footer. The amount is coming
from a subreport included in the report. I created a new field in the
subreport called Text19 that calculates =Sum([Weight]). If I run the
subreport by itself it will do the subtotals correctly. I refer to this new
field in my report footer when I try to calculate the total.

If I use the following in my report footer:
=(srpt_MasterBillOfLading!text19) the report will run but the total will
come back 0 (zero).

If I use =sum(srpt_MasterBillOfLading!text19) the report will not run.
Instead it will ask for a Parameter Value. If I put a number in the
parameter value, this is the number that will be displayed on the report.

What am I be doing wrong?

Thanks,

Mary
 
T

tina

well, i'm stumped. i think i probably don't have an accurate picture of the
setup, but can't think of any questions that will clarify the problem.
suggest you hang with this thread for a day or so, Mary. if nobody else
posts back with a solution that works for you, i'm willing to take a look at
a copy of your db (sans proprietary data) and try to figure out the problem.
you can post back if you want me to do that. sorry i couldn't be of
immediate assistance.


Mary said:
Hi there,

I did as you said... The subreport is called srpt_MasterBillOfLading...
That's what I already have, but I still used the copy function to copy the
name exactly and then I rewrote the report footer field code to
=Sum(srpt_MasterBillOfLading.Report!text19).

Same issue as before. It asks for a Parameter Value. If I remove "Sum" then
the report will run but with no total value.

So then I tried to change the Name of the subreport (in the property field
you mention below) to just Subreport... So now it's
=Sum(subreport.Report!text19) but still the same result.

Thanks!

Mary


tina said:
first, make sure you're using the *correct* name of the subreport control
within the main report. sometimes that's the same as the name of the
subreport object in the database window, but sometimes it's different. open
the main report in design view. click *once* on the subreport, within the
main report, to select it. in the Properties box, click on the Other tab.
look at the Name property.

once you have the correct name of the subreport control, try

=Sum(SubreportControlName.Report!text19)

hth


Mary said:
Hi,

I'm trying to calculate a total in my report footer. The amount is coming
from a subreport included in the report. I created a new field in the
subreport called Text19 that calculates =Sum([Weight]). If I run the
subreport by itself it will do the subtotals correctly. I refer to
this
new
field in my report footer when I try to calculate the total.

If I use the following in my report footer:
=(srpt_MasterBillOfLading!text19) the report will run but the total will
come back 0 (zero).

If I use =sum(srpt_MasterBillOfLading!text19) the report will not run.
Instead it will ask for a Parameter Value. If I put a number in the
parameter value, this is the number that will be displayed on the report.

What am I be doing wrong?

Thanks,

Mary
 
M

Marshall Barton

Mary said:
I'm trying to calculate a total in my report footer. The amount is coming
from a subreport included in the report. I created a new field in the
subreport called Text19 that calculates =Sum([Weight]). If I run the
subreport by itself it will do the subtotals correctly. I refer to this new
field in my report footer when I try to calculate the total.

If I use the following in my report footer:
=(srpt_MasterBillOfLading!text19) the report will run but the total will
come back 0 (zero).

If I use =sum(srpt_MasterBillOfLading!text19) the report will not run.
Instead it will ask for a Parameter Value. If I put a number in the
parameter value, this is the number that will be displayed on the report.


The aggregate functions (Count, Sum, etc) only opreate on
fields in the form/report's record source table/query. They
are unaware of controls on the main report and certainly
have no concept of what's in a subreport.

To pull the subreport's total onto the main report, use a
text box named txtRunTotal with the expression:
=srpt_MasterBillOfLading.REPORT!text19
and set the text box's RunningSum property to Over All.
This text box must be in the same section that contains the
subreport.

A text box in the mainreport's footer section can then
display the grand total by using the expression:
=txtRunTotal
 
G

Guest

I don't know if this will help but sometimes referencing a field from a
subreport in a main report is really odd.... Try this in your text box on
your main form: (replacing w/your correct names)....

=[Reports].[MainReportName].[SubreportName]![subfieldname]

Hope that helps...

Heidi :)
 
M

Mary

aaaah. I get it.

Thanks, it works!

Mary


Marshall Barton said:
Mary said:
I'm trying to calculate a total in my report footer. The amount is coming
from a subreport included in the report. I created a new field in the
subreport called Text19 that calculates =Sum([Weight]). If I run the
subreport by itself it will do the subtotals correctly. I refer to this new
field in my report footer when I try to calculate the total.

If I use the following in my report footer:
=(srpt_MasterBillOfLading!text19) the report will run but the total will
come back 0 (zero).

If I use =sum(srpt_MasterBillOfLading!text19) the report will not run.
Instead it will ask for a Parameter Value. If I put a number in the
parameter value, this is the number that will be displayed on the report.


The aggregate functions (Count, Sum, etc) only opreate on
fields in the form/report's record source table/query. They
are unaware of controls on the main report and certainly
have no concept of what's in a subreport.

To pull the subreport's total onto the main report, use a
text box named txtRunTotal with the expression:
=srpt_MasterBillOfLading.REPORT!text19
and set the text box's RunningSum property to Over All.
This text box must be in the same section that contains the
subreport.

A text box in the mainreport's footer section can then
display the grand total by using the expression:
=txtRunTotal
 

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