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

Fix Up Variant To Boolean Mand Sub Sub
Fix Ups Class

Public Sub FixUpVariantToBooleanMandSub( _
      ByRef rArgument As Variant _
    , ByVal vDefault As Variant _

"Fix Up Variant To Boolean Mandatory Subroutine"
Convert numeric, date/time, numeric string, and date/time string Variant values to the Boolean data type.
Assign the default value vDefault to the argument rArgument if conversion is not possible.

See also:
    FixUpVariantToBooleanMaybeSub Subroutine
    FixUpVariantToBooleanMandFn Function
rArgument: The argument which is changed to a Boolean value, if possible. Subroutine assigns the default vDefault to rArgument if conversion was not possible, such as when the rArgument is out-of-range, missing, Null, an error, a pointer, or a non-numeric string.
Note: rArgument is a passed by reference, so the variable passed from the calling function will likely be modified.
vDefault: The default value which is assigned to rArgument when conversion is not possible.
Note: The default value can be a data type other than Boolean (as in example #3) as long as it is compatible with the variable passed via rArgument.

Example #1:

       Dim varFlag As Variant
       varFlag = "0"
    for example
       FixUpVariantToBooleanMandSub varFlag, True
       varFlag = False
       VarType(varFlag) = vbBoolean
Example #2:
       Dim varFlag2 As Variant
       varFlag2 = "Word"
    for example
       FixUpVariantToBooleanMandSub varFlag2, True
       varFlag2 = True
Example #3:
       Dim varFlag3 As Variant
       varFlag3 = "Word"
    for example
       FixUpVariantToBooleanMandSub varFlag3, Null
       IsNull(varFlag3) = True

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