Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using IsNull

Status
Not open for further replies.

ceciliag8

Technical User
Mar 17, 2002
4
CA
I'm having problems with IsNull. I have a table with numeric values. The query looks at the depth value, and determines how deep it is (i.e. surface, shallow, medium & deep).
There are some cells that don't have any info in them, but when I run the query, it still returns a value, such as surface, or medium, etc.

this is what my formula looks:
Depth: IIf([ALLQUAKE]![Depth]<15,&quot;Surface&quot;,IIf([ALLQUAKE]![Depth]<40,&quot;Shallow&quot;,IIf([ALLQUAKE]![Depth]<100,&quot;Medium&quot;,&quot;Deep&quot;)))

I was told to use IsNull, but I don't know how I would use it, or even the syntax of it.

Does this make sense to anyone? Can anyone help me?
 
Access uses the nz function to plug a value when the field is null. This will return 7777 if the field is null otherwise it will return the custnum. Don't confuse isnull in Access with isnull in SQL Server they are different.

SELECT iif (NZ([custnum],&quot;0&quot;)>&quot;0&quot;,custnum,7777) AS Expr1
FROM dbo_customer;
 
You could could use this syntax

IIF(IsNull([Field]),0,[Field])

This would replace the any null records with a numeric 0. You could enter text or anything else you desired.

Johnny X
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top