Solved

Convert Null to 0

Posted on 2004-09-22
4
670 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 50 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
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 …
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

628 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