<-- Previous || Up || Next -->

Empty To Value Function
Convert Values Class

Public Function EmptyToValue( _
      ByVal vValue As Variant _
    , ByVal vReplace As Variant _
    ) As Variant

Replace Empty values with some default value.
Leave all other types of values unchanged.

Example:
    Assuming
       Dim varEmpty As Variant
    for example
       EmptyToValue(varEmpty, 0) = 0
       EmptyToValue(EmptyValue, "N/A") = "N/A"
       IsNull(EmptyToValue(Null, 0)) = True
       EmptyToValue("Word", "N/A") = "Word"
       EmptyToValue(123456, 12) = 123456
See also:
    EmptyToBlank Function
    EmptyToNull Function
    EmptyValue Property
vValue: The value which is to be returned as-is unless it is empty, in which case vReplace will be returned.
vReplace: The value that will be returned if vValue is Empty. Function returns vValue unchanged in all other cases.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.