Null represents the absence of any value (i.e., no record, or no field
value)...and can only be assigned to a Variant data type. Empty indicates
that a Variant type variable has been declared, but a value has not been
assigned....its basically a default assignment. "" represents an empty
string. Each indicates no value, but in a different context. Logically,
you have to code differently to test for the condition. Or you might use
something like this...
Function IsNothing(varArg As Variant) As Boolean
'Checks whether argument is Null, Empty, empty string, or Nothing
On Error GoTo Err_IsNothing
IsNothing = False
Select Case VarType(varArg)
Case vbEmpty
IsNothing = True
Case vbNull
IsNothing = True
Case vbString
If Len(varArg) = 0 Then
IsNothing = True
End If
Case vbObject
If varArg Is Nothing Then
IsNothing = True
End If
End Select
Exit Function
Err_IsNothing:
IsNothing = True
End Function
If the data type of the variable being passed is something other than
Variant, String, or an Object, there is not much point in using the
function. For example, passing any Integer variable would also result in
False because an Integer is 0 by default...therefore, it has a value.