Nz() in IIF

message from =?Utf-8?B?Sk1vcnJlbGw=?= on 17 May 2004
=IIf([aupdateval],(nz([annbal]-[suma])+[aupdateval]),(nz([annbal]-[suma])))

If [aupdateval] contains a value and if there is no value for [suma], the statement only returnes [aupdateval]. What am I missing in my IIF statement? Ultimately, I want to return the sum of ([annbal]-[suma]+[aupdateval]), regardless of their initial values (null or not).

tia,
JMorrell
 
fredg replied to =?Utf-8?B?Sk1vcnJlbGw=?= on 17 May 2004
Does this work for you?
=IIf([aupdateval],Nz([annbal])-Nz([suma])+[aupdateval],
(Nz([annbal])-Nz([suma]))

Or more simply (no IIf needed):
=Nz([annbal]) - Nz([suma]) + Nz([aupdateval])
 
=?Utf-8?B?Sk1vcnJlbGw=?= replied to fredg on 17 May 2004
The simple solution is always the best. It works fine, thank you.
 

Archived message: Nz() in IIF (Microsoft Access Database)