Function Convert Values Class

EmptyToNull

Replace an Empty value with a Null value. Leave all other types of values unchanged.

Signature (Visual Basic / VBA)

Public Function EmptyToNull( _
    ByVal vValue As Variant _
    ) As Variant

Code Example

    Assuming
       Dim varEmpty As Variant
    for example
       IsNull(EmptyToNull(varEmpty)) = True
       IsNull(EmptyToNull(EmptyValue)) = True
       IsNull(EmptyToBlank(Null)) = True
       IsNull(EmptyToNull("Word")) = False
       IsNull(EmptyToBlank(123456)) = False

Parameters

Parameter Description
vValue The value which is to be changed from Empty to Null if appropriate. Function returns Null if vValue is an Empty Variant. Function returns vValue unchanged in all other cases.