Checking wether a karakter is a number

  • Thread starter Thread starter Erwin Bormans
  • Start date Start date
E

Erwin Bormans

Dear,

I've got a string for example:

"NECO 101880 941 NECO KOZIJNEN"

This string is never the same, but i need the 101880 nr.

Is there a way i can check wether a karakter in that string is a number or
not?

Thanks in advance,
Kind regards,
Erwin
 
Unfortunately, you'll get false positives with that approach, since, for
example, IsNumeric("1E2") returns True (Access assumes the E is an exponent,
so that that equals 100)

You may want to use

If Str(Val(strTestString(I))) = strTestString(I) Then
MsgBox "Token number " & I & " is numeric."
End If



"Bill" wrote in message

You could do something like:

Option Compare Database
Option Explicit
Private Sub TestSub()

Dim strTestString() As String
Dim strMyString As String
Dim I As Integer

strMyString = "NECO 101880 941 NECO KOZIJNEN"
strTestString = Split(strMyString, " ")

For I = 0 To UBound(strTestString)
If IsNumeric(strTestString(I)) Then
MsgBox "Token number " & I & " is numeric."
End If
Next

End Sub
 
Back
Top