Signature (Visual Basic / VBA)
Public Function CompareLikeDataTypeFast( _
ByRef vOne As Variant _
, ByRef vTwo As Variant _
, ByRef vCompare As VbCompareMethod _
) As Integer
Code Examples
CompareLikeDataTypeFast("ALL", "all", vbBinaryCompare) = -1
CompareLikeDataTypeFast("all", "ALL", vbBinaryCompare) = 1
CompareLikeDataTypeFast("ALL", "all", vbTextCompare) = 0
CompareLikeDataTypeFast("3", 3, vbTextCompare) = 1
-1 if vOne < vTwo
0 if vOne = vTwo
1 if vOne > vTwo
vTwo
D S
vOne D n -
S + s
D = Date/Numeric
S = String
- = Return -1
+ = Return 1
s = Do String comparison with StrComp
n = Do numeric/Date comparison
Parameters
| Parameter | Description |
|---|---|
| vOne | First of two values to be compared. |
| vTwo | Second of two values to be compared. |
| vCompare | Specifies the comparison type and sort order/collating sequence used when comparing string values. |
Notes & Version History
| Function returns | See the following table which describes how comparisons are made depending upon data type of arguments. |
| Summary | With Number/Date and Number/Date, use numeric comparison. With Number/Date and String, COMPARE THE VARTYPE. With String and String, use string comparison. |