Function Comparisons Class

EqualExactDataType

Return True if the values vOne and vTwo equal each other, otherwise return False. Considers the values of all Visual Basic data types to be distinct so that, for example, a Single value of 34.5! would not equal a Double value of 34.5#.

Signature (Visual Basic / VBA)

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

Code Examples

    EqualExactDataType("ALL", "all", vbBinaryCompare) = False
    EqualExactDataType("all", "ALL", vbBinaryCompare) = False
    EqualExactDataType("ALL", "all", vbTextCompare) = True
    EqualExactDataType("3", 3) = False
    EqualExactDataType(Null, 3) = False
    True  if vOne =  vTwo
    False if vOne <> vTwo
    Null = Null -> True.
    Empty = Empty -> True.
    Use String comparisons on strings.
    Use Numeric comparison on numbers and/or dates.
    The data type of both arguments must be the same for comparison to take place.

Parameters

Parameter Description
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 performing string comparisons. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number.

Notes & Version History

Details If the arguments vOne and vTwo have the same data type, then compare the values. If arguments are of different types, then perform the comparison ON THE VARTYPE OF THE ARGUMENTS.