Public Function MostCapableDataType( _ ByVal vOne As Variant _ , ByVal vTwo As Variant _ ) As Integer
MostCapableDataType(CInt(1), CLng(1)) = vbLong MostCapableDataType(CLng(1), CSng(1)) = vbSingle MostCapableDataType(CBool(1), CByte(1)) = vbIntegerSee also:
MostAccurateDataType Function PromoteToMostCapableDataType Function CoerceToType FunctionSummary: If one argument is Null, then the type of the other argument is the "most capable" If one argument is Empty, then the type of the other argument is the "most capable" If one argument is String, then String is the "most capable" Otherwise, the table below describes the result.
vOne Boo Byt Int Lng Sng Dbl Cur Dec Dat +------------------------------------ v Boo | Boo Int Int Lng Sng Dbl Cur Dec Dbl v Byt | Int Byt Int Lng Sng Dbl Cur Dec Dbl a Int | Int Int Int Lng Sng Dbl Cur Dec Dbl r Lng | Lng Lng Lng Lng Dbl Dbl Cur Dec Dbl T Sng | Sng Sng Sng Dbl Sng Dbl Dbl Dbl Dbl w Dbl | Dbl Dbl Dbl Dbl Dbl Dbl Dbl Dbl Dbl o Cur | Cur Cur Cur Cur Dbl Dbl Cur Dec Dbl Dec | Dec Dec Dec Dec Dbl Dbl Dec Dec Dbl Dat | Dbl Dbl Dbl Dbl Dbl Dbl Dbl Dbl DatLegend:
Boo = Boolean Byt = Byte Cur = Currency Dat = Date Dec = Decimal Dbl = Double (precision floating-point) Int = Integer Lng = Long (integer) Sng = Single (precision floating-point)v1.5 Change: This function has been extended to support the new Decimal data type in VB 6.0.
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.