Signature (Visual Basic / VBA)
Public Function CompareExactDataType( _
ByVal vOne As Variant _
, ByVal vTwo As Variant _
, Optional ByVal vCompare As Variant _
) As Integer
Code Examples
CompareExactDataType("ALL", "all", vbBinaryCompare) = -1
CompareExactDataType("all", "ALL", vbBinaryCompare) = 1
CompareExactDataType("ALL", "all", vbTextCompare) = 0
CompareExactDataType("3", 3) = 1
CompareExactDataType(Null, 3) = -1
-1 if vOne < vTwo
0 if vOne = vTwo
1 if vOne > vTwo
Parameters
| Parameter | Description |
|---|---|
| vOne | First of two values which are to be compared to determine if it is less than, equal to, or greater than the other. |
| vTwo | Second of two values which are to be compared to determine if it is less than, equal to, or greater than the other. |
| 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. |
| Summary | 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. |