IFF Null or NZ

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.
 
G

Graham Mandeno

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 )
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top