Dsum return 0 instead of Null?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any way to have a calculated control using DSum to return a 0
instead of null? I'm adding a bunch of DSum controls and if one is null the
addition fails.

tia
 
Is there any way to have a calculated control using DSum to return a 0
instead of null? I'm adding a bunch of DSum controls and if one is null the
addition fails.

tia

Wrap the DSum() in a call to NZ() - Null to Zero.

NZ(DSum(...))

John W. Vinson[MVP]
 
A quick fix to this problem that I found is to multiply the calculation by
one. It turns the field numeric and enters zeros instead of nulls. It also
enables you to do numerical formatting easily.
 
I don't think Joan meant DSum(...) * 1, I think she meant:
Nz(DSum(...)) * 1 converts Null to 0

This is because Nz(DSum(...)) converts Null to Empty
and Empty * 1 yields 0.

The proper way to do this is:
Nz(DSum(...), 0)

This makes use of the Nz function's optional second argument.
 
Back
Top