?
Solved

Convert Null to 0

Posted on 2004-09-22
4
Medium Priority
?
671 Views
Last Modified: 2008-02-01
Hi all,

How do I convert null to 0 in Access?

Thanks,

Adi
0
Comment
Question by:vbtiger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 12120383
Nz([YourField],0)
0
 
LVL 1

Accepted Solution

by:
AJ_UK earned 200 total points
ID: 12121299
that works for variables of type "Variant", but for others the following will work:

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

Cheers,
AJ
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 12123205
Only a Variant can hold Nulls.
0
 
LVL 1

Expert Comment

by:AJ_UK
ID: 12123747
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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question