Linq Adams via AccessMonster.com said:
IsNumeric() will return True for strings that have A-F in them if the
string
can represent hex numbers.
That's not exactly right. It's not that the string could represent
hexadecimal numbers -- for example, the characters A , B, and C are not
permitted -- but that the number could be an expression using exponential
notation, in which D, E, and F all indicate that what follows is an
exponent.
Here's a replacement function that solves this problem. Place it in a
standard module. If this is a new module, when prompted by Access to name
the
module, name it anything EXCEPT
BetterIsNumeric
Public Function BetterIsNumeric(ByVal Value As String) As Boolean
If Value Like "*[!0 9.]*" Then
BetterIsNumeric = False
Else
BetterIsNumeric = True
End If
End Function
I think the pattern for that Like expression is wrong, and should be
"*[!0-9.]*".
Note that the above function won't handle a leading or trailing sign, and
will accept as numeric strings such as "12.34.56". So it's not as
comprehensive as IsNumeric. For a better IsNumeric, I'd be inclined to
start with IsNumeric and make an additional test:
Public Function AnotherIsNumeric(ByVal Value As Variant) As Boolean
If IsNumeric(Value) Then
If Value Like "*[D-F]*" Then
AnotherIsNumeric = False
Else
AnotherIsNumeric = True
Else
AnotherIsNumeric = False
End If
End Function