Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sum of Row totals

Status
Not open for further replies.

xicana

Technical User
Dec 11, 2003
100
US
I have a text box in a group that displays the sum of the values in 3 other text boxes (within the same group):

Field Name: Control Source:
textBox1 dlookup(...)
textBox2 dlookup(...)
textBox3 dlookup(...)
Total =nz(Reports![Report]!textBox1,0)+nz (Reports![Report]!textBox2,0)+nz(Reports![Report]!textBox3,0)

Each row in the group looks like this:

textBox1 textBox2 textBox3 Total

I have a TOTALS row where I total up the columns for each row. I also want to get the sum of the Total column...I have tried:
Code:
=sum(Reports![NameofReport]![Total])
That didn't give me an error - but didn't total anything.
Code:
=sum([Total])
This one asked me for a [Total] parameter when I ran the report.

Looks like it should be an easy solution...

Sandy
 
Sandy
In the Report Footer, have you tried putting a text box with a structure such as...
=Sum([textBox1]) + Sum([textBox2]) + Sum([textBox3])

You might have to include the Nz for each of those, if there is a possibility of a 0 value.

You could also try Sum(Abs([textBox1]) + etc...

Tom

 
Code:
=NZ(Sum(Reports![REPORT]!textBox1))+NZ(Sum(Reports![REPORT]!textBox2))+NZ(Sum(Reports![REPORT]!textBox3))

I tried the above - and it gave me zero's all the way down (even when I knew there should be numbers). I tried it without the nz and it didn't give me anything. Also, I have to reference the report I am in - else it asks me for parameters when I run the report.

I also tried using abs()(like you suggested) but that didn't work either. I am putting the totals were they are supposed to be - in the group footer. The fields that I'm trying to get totals for are fields that I put formulas into (calculated fields - see original post)... is that the problem? If so, how do i get around it?

Sandy
 
You can't sum CONTROLS from one section to another. You can sum the expressions from most controls. For instance, if you have a text box:
Name: txtNetCost
Control Source: = Qty * UnitPrice
You can't sum in a footer with:
Control Source: =Sum(txtNetCost)
You can sum in a footer with:
Control Source: =Sum(Qty * UnitPrice)

This looks very slow using dlookup(). I would have to believe there is a better solution.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Thanks for the info Duane...

You're right - using dlookup, Access shuts down on me. I need to get those totals though...I guess I'll have to figure out a way around it...

Thanks guys!
Sandy

Sandy
 
Sandy,

We might be able to help you rid your life of dlookup() if we knew more about your situation.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Thanks to you both...I appreciate your help...we've decided to create this report in crystal...turned out to be way easier.

=)



Sandy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top