Convert Null to 0

Hi all,

How do I convert null to 0 in Access?

Thanks,

Adi
vbtigerAsked:
Who is Participating?
 
AJ_UKConnect With a Mentor Commented:
that works for variables of type "Variant", but for others the following will work:

IIf(IsNull([YourField]), 0, [YourField])

Cheers,
AJ
0
 
shanesuebsahakarnCommented:
Nz([YourField],0)
0
 
shanesuebsahakarnCommented:
Only a Variant can hold Nulls.
0
 
AJ_UKCommented:
Sorry, I meant "others" to mean other situations, not other variable types. Data fields can hold null values, and both queries and recordset manipulation sometimes need to avoid or manipulate null values encountered.  Not sure where Adi was working in Access.
Best to convert any null data values when assigning to other than "variant" type variables--like you said, only variant can hold null, so other variable types will give error on assignment of null.
AJ
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.