- Home
·
- Miscellaneous
·
- Duplicates the Nz function found in Access VBA to replace a NULL with a default value or object.
Duplicates the Nz function found in Access VBA to replace a NULL with a default value or object.
Duplicates the Nz function found in Access VBA to replace a NULL with a default value or object.
Rate Duplicates the Nz function found in Access VBA to replace a NULL with a default value or object.
(1(1 Vote))
' returns ValueIfNull if Expression is null,
' returns zero if Expression is null and ValueIfNull is missing
' else returns Expression
'==============================================================
'example:
' With udtExistingRecord
' .RespCode = Trim(Nz(rsCreditCardData!RespCode, ""))
' .fErrors = Nz(rsCreditCardData!fErrors, 0)
' booErrors = Nz(rsCreditCardData!fErrors, 0)
' .Description = Trim(Nz(rsCreditCardData!Description, ""))
' .CardNum = Trim(Nz(rsCreditCardData!CardNum, ""))
' End With
'==============================================================
If Not IsMissing(ValueIfNull) Then
If IsNull(Expression) Or IsEmpty(Expression) Then
If IsObject(ValueIfNull) Then
Set Nz = ValueIfNull
Else
Nz = ValueIfNull
End If
Else
GoTo NotNull
End If
Else
If IsNull(Expression) Then
Nz = 0
Else
GoTo NotNull
End If
End If
Exit Function
NotNull:
If IsObject(Expression) Then
Set Nz = Expression
Else
Nz = Expression
End If
End Function
Duplicates the Nz function found in Access VBA to replace a NULL with a default value or object. Comments
No comments yet — be the first to post one!
Post a Comment