Calclating totals - Sum fails on empty column - Rookie

  • Thread starter Thread starter Andy
  • Start date Start date
I have a simple form in continuos view. I have placed a textbox in the
form's footer to calculate totals of 2 "money" column (SQL Server), with the
control code:

=Sum([MYVAL1]) + Sum([MYVAL2])

If at least one value is set in both the columns the function works. If one
of the two columns has no values the function fails. It doesn't display any
"#error" in the text box, it simply blanks the contenent.

Example:

Row MYVAL1 MYVAL2
1 10
2
3 20

Works and returns: 30


Row MYVAL1 MYVAL2
1
2 50
3

Doesn't work and returns nothing (empty)

Any hint?
 
Atlas,

Adding a Null to anything produces a Null as a result. This means one of
your totals remains Null.

Try Nz(Sum([MyVal1),0) + Nz(Sum([MyVal2]),0)

Rod Scoullar.
 
Try Nz(Sum([MyVal1),0) + Nz(Sum([MyVal2]),0)

Rod now it works fine!

Thanks (rookie improving....)
 
Back
Top