Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 678
  • Last Modified:

Convert Null to 0

Hi all,

How do I convert null to 0 in Access?

Thanks,

Adi
0
vbtiger
Asked:
vbtiger
  • 2
  • 2
1 Solution
 
shanesuebsahakarnCommented:
Nz([YourField],0)
0
 
AJ_UKCommented:
that works for variables of type "Variant", but for others the following will work:

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

Cheers,
AJ
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now