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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Functions returning Nulls

Status
Not open for further replies.

rorymurray

Programmer
Oct 16, 2001
44
AU
How do you deal with a function returning a null value? I know PL/SQL has a function nvl() that can put something in place of a null if null is returned. Does VBA have anything like that?
 
ps=null
If IsNull(ps) Or IsEmpty(ps) Then
ps = 0
End If
 
or
Nz(variant[, valueifnull])
You can use the Nz function to return zero, a zero-length string (" "), or another specified value when a Variant is Null. For example, you can use this function to convert a Null value to another value and prevent it from propagating through an expression.
 
You might also try the
Code:
IS Nothing
test.
Code:
If nvl IS NOTHING Then
    MsgBox "Daaaa... I got nothing!"
    nvl = 0
End If
----------------------------------------
If you are reading this, then you have read too far... :p

lightwarrior@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top