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....)
 

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

Similar Threads

Access #Error & Excel Pivot 0
Null Value in Subform Total 4
Sum of multiple boxes 12
Nz Function 3
Account for null values on a report 2
empty string issue 4
IFF Null or NZ 1
Invoice Report 1

Back
Top