IFF Null or NZ

  • Thread starter Thread starter Rpettis31
  • Start date Start date
R

Rpettis31

I have am trying to suppress a #error I have on a text box that is not filled
till the user makes a selection. I have tried the Nz with no luck.
=NZ(CLng([lstMainItems].[column](4)),"0")
I am just looking to display the value the user selects or show 0 if there
is an error due to a null.
 
Hi Rpettis31

The error is occurring because you are trying to use CLng on a Null value.
Also, if CLng does return a result, it will never be Null, so the Nz would
be unnecessary. You need to reverse the CLng and the Nz:

=CLng( Nz( [lstMainItems].[column](4), 0 ) )

Actually, unless you really need the result to be a numeric data type, you
can omit the CLng altogether:

=Nz( [lstMainItems].[column](4), 0 )
 
Back
Top