=SUM .. Confused :/ (1 Viewer)

rob1

Registered User.
Local time
Today, 05:44
Joined
Jun 7, 2012
Messages
11
Im tryin to add 5 items together to get an overall total

Text44
Text46
Text47
Text48
Text49

These text boxes already contain expressions to gain me the subtotals.

Im wanting to get an overall total but using just
"=[Text44]+[Text46]+[Text47]+[Text48]+[Text49]"
Gives me a blank box

and

"=Sum([Text44]+[Text46]+[Text47]+[Text48]+[Text49])"
Asks me for parameters when I launch the report.

Im soo confused :/
 

joeKra

Registered User.
Local time
Today, 00:44
Joined
Jan 24, 2012
Messages
208
Why would you use the Double quotes?
are they bound to a integer or currency field?
 

tpuhlig

Registered User.
Local time
Yesterday, 21:44
Joined
Nov 20, 2009
Messages
15
if you have a blank in one of those fields, you will get a blank.

I would put a default value of zero in each field so there are no blank. Also, I would put that calculation in your query and then pull it into your report.
 

Sketchin

Registered User.
Local time
Yesterday, 21:44
Joined
Dec 20, 2011
Messages
575
I did something like this and placed it into the report footer.

="Grand Total " & Sum([Total Usage Days])

Total Usage Days is calculated in the same query that the report is based on.

Hope this helps
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 00:44
Joined
Feb 19, 2002
Messages
43,484
Code:
=Nz([Text44],0) + Nz([Text46],0) + Nz([Text47],0) + Nz([Text48],0) + Nz([Text49],0)
The Nz() function (null-to-zero) will change nulls to whatever you specify. I specified 0 in each case. The default is 0 for numeric fields and "" for text. I always specify a value because I don't want to have to lookup the data type, if I ever have to go back to the code to see what will actually be returned.

Also - change the control names. Text44, etc. is completely uninformative and you'll never remember what it is when you are looking at the code next week let alone next year.
 

Users who are viewing this thread

Top Bottom