Right to find any letters

Design by Sue

Registered User.
Local time
Today, 03:35
Joined
Jul 16, 2010
Messages
816
I have a field (SNumber) which is a text field and contains records that have a number which sometimes also have 2 letters on the right. ( examples: 1, 2, 3CD, 5, 6 HD). I am using the Right function in a code I am writing.

If Right (SNumber, 2) = "CD" then
.....rest of code here

I would like instead of stating actual letters to code "any 2 digits". Can this be done and what is the correct code for any digits in this instance?


Thanks
 
To complete the code supplied by Bob

If Not IsNumeric(Right (SNumber, 2)) Then intOut = Val(SNumber)

Val returns the number part of any string that starts as numeric.

BTW Just a couple of things to watch for with Val(). An E or D followed by numerics because these are interpreted as exponential notation.

eg 12E2 or 12D2 come out as 1200.
 

Users who are viewing this thread

Back
Top Bottom