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

Equal Coerce Data Type Function
Comparisons Class

Public Function EqualCoerceDataType( _
      ByVal vOne As Variant _
    , ByVal vTwo As Variant _
    , Optional ByVal vCompare As Variant _
    ) As Boolean

Return True if the values vOne and vTwo equal each other, otherwise return False.
Attempts to fix-up different types of values to compatible data types.

Examples:
    EqualCoerceDataType("ALL", "all", vbBinaryCompare) = False
    EqualCoerceDataType("all", "ALL", vbBinaryCompare) = False
    EqualCoerceDataType("ALL", "all", vbTextCompare) = True
    EqualCoerceDataType("3", 3) = True
    EqualCoerceDataType(Null, 3) = False
See also:
    EqualExactDataType Function
    EqualLikeDataType Function
    CompareCoerceDataType Function
    StrComp Function (Visual Basic)
Function returns:
    True  if vOne =  vTwo
    False if vOne <> vTwo
See the following table which describes how comparisons are made depending upon data type of arguments.
Summary:
    Null = Null -> True
    Null = Not Null -> False
    Empty = Empty -> True
    Empty = Nut Empty -> False
    Number/Date = Number/Date -> Use numeric comparison.
    Number/Date/String = String -> Use string comparison.
vOne: First of two values which are to be compared for equality.
vTwo: Second of two values which are to be compared for equality.
vCompare: Specifies the comparison type and sort order/collating sequence used when comparing string values. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number.
Return value:
             vTwo
           E N D S
    vOne E T F F F
         N F T F F
         D F F n s
         S F F s s
VarType Codes:
    E = Empty
    N = Null
    D = Date/Numeric
    S = String
Action Codes:
    T = Return True
    F = Return False
    s = Do String comparison with StrComp
    n = Do numeric/Date comparison

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