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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to add sums of columns for a grand total 1

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
In a report that I have =Sum([fieldname]) in the Group footer. This works fine. For each field. I also need a total or sum of all of the Sums in the footer for a grand total.
I have this but it returns nothing no error nothing
=Sum([Sat])+Sum([Sun])+Sum([Mon])
It is in the same Group footer to the right of the other sums. Any ideas how I can get a grand total of the sums. If I use this it prompts for each box; =Sum([txtSat])+Sum([txtSun]) etc.

TIA


DougP
 
Have you tried
=Sum([fieldname])
In the report footer?
 
I would like to get sums for each Group footer which is why I put it there. Each Group ityem is a job Let me give more info about the report. Say someone works on a Job 2 hours Mon, 3 hours Tues and 1 Thur . So for the job they worked 6 hours I want a box to have 6 in it.

Job Mon Tue Wed Thur Fri Total
333 2 3 1 6
444 3 1 5 1 10

Right now the 2 hours on Mon is gotten by =Sum([Mon]) in the textbox


DougP
 
Ok. I misunderstood you.

You will need to do the whole thing again, as far as I know, that is:

= Sum(Mon) + Sum(Tue) ... + Sum(Fri)
 
As you can see in my original post I tried that!!!

DougP
 
Oops.

Both the methods you show work for me. I have noticed in forms that if one sum has an error, they will all fail. Have you tried using the expression builder?
 
I expect some of your fields have null values. If so, you must convert the null to a numeric value in order to sum them.
[tt][blue]
=Sum(Nz(Mon,0)) + Sum(Nz(Tue,0)) ... + Sum(Nz(Fri,0)) [/blue][/tt]

Duane
Hook'D on Access
MS Access MVP
 
I think Duane may be right.

Does the report field show #value or nothing ?

If It's #value, then your expression syntax is in error.

If it' nothing, than a null is propegating.

Remember, a null used in any expression will always return null.

Tyrone Lumley
SoCalAccessPro
 
Dooh!!! some of the columns like Sat and Sun contain a NULL so when added the whole result is Null
I need to add NZ(...) like as shown above
I just figured that out and came back to see you also said it SoCalAccessPro

Thanks people



DougP
 
a more generic solution is buried in these fora I think it is "basSum(ParamArray varMyVals())".



MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top