Handling Nulls when adding fields

D

Dylan Moran

I want to do some currency calulcations on fields on a form and handle any
nulls.

I have read the help and am having some troubles.

Formuals is:

=Nz([SalesRevenue]-[ABCExpense]-[XYZExpense],0)

With a null value in the fields ABCExpense or XYZExpense, the result is 0.

Your assistance is appreciated.
 
D

Dirk Goldgar

Dylan Moran said:
I want to do some currency calulcations on fields on a form and
handle any nulls.

I have read the help and am having some troubles.

Formuals is:

=Nz([SalesRevenue]-[ABCExpense]-[XYZExpense],0)

With a null value in the fields ABCExpense or XYZExpense, the result
is 0.

Your assistance is appreciated.

You need to wrap each field in Nz, not the whole expression. Like this:

=Nz([SalesRevenue], 0)-Nz([ABCExpense], 0)-Nz([XYZExpense],0)
 
D

Dylan Moran

Many thanks.

Dirk Goldgar said:
Dylan Moran said:
I want to do some currency calulcations on fields on a form and
handle any nulls.

I have read the help and am having some troubles.

Formuals is:

=Nz([SalesRevenue]-[ABCExpense]-[XYZExpense],0)

With a null value in the fields ABCExpense or XYZExpense, the result
is 0.

Your assistance is appreciated.

You need to wrap each field in Nz, not the whole expression. Like this:

=Nz([SalesRevenue], 0)-Nz([ABCExpense], 0)-Nz([XYZExpense],0)

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Top