Forum Discussion
Tony2021
Aug 27, 2022Iron Contributor
Using Nz. Is =0 necessary?
hello Experts, I need to get this off my mind. In order to properly test for Nz you only need to test like this if your field is a number: Nz([Amount],0) what's confusing to me is that I ...
- Aug 28, 2022Nz([Expr1], [Expr2]) function, simly means:
If the Value in [Expr1] is Null then Substitute [Expr2] as Return value, otherwise return the Value of [Expr1].
If you omit [Expr2] then the Default (which is a Null String "") will be returned.
Tony2021
Aug 28, 2022Iron Contributor
thanks George.
One follow up:
<Nz([Amount],0) returns a non-null value that could be any possible value from your Amount field, including 0 because, again 0 is not null.
==>in the case of Null then it would return 0, correct?
One follow up:
<Nz([Amount],0) returns a non-null value that could be any possible value from your Amount field, including 0 because, again 0 is not null.
==>in the case of Null then it would return 0, correct?
arnel_gp
Aug 28, 2022Iron Contributor
Nz([Expr1], [Expr2]) function, simly means:
If the Value in [Expr1] is Null then Substitute [Expr2] as Return value, otherwise return the Value of [Expr1].
If you omit [Expr2] then the Default (which is a Null String "") will be returned.
If the Value in [Expr1] is Null then Substitute [Expr2] as Return value, otherwise return the Value of [Expr1].
If you omit [Expr2] then the Default (which is a Null String "") will be returned.
- George_HepworthAug 28, 2022Silver Contributor
If the value of the variant argument is Null, the Nz function returns the number zero or a zero-length string (always returns a zero-length string when used in a query expression), depending on whether the context indicates the value should be a number or a string. If the optional valueifnull argument is included, then the Nz function will return the value specified by that argument if the variant argument is Null. When used in a query expression, the NZ function should always include the valueifnull argument,
If the value of variant isn't Null, then the Nz function returns the value of variant.
- Tony2021Aug 30, 2022Iron Contributorthanks guys. I now know the =0 part is not necessary in:
Nz([Amount],0)=0
unless you are testing for some reason if it is =0.
I will update my cheat sheet.