View Full Version : Testing condition of field/variable characters


chiodde
02-12-2002, 03:17 AM
I am trying to write a visual basic module that extracts records from an access database and processes them.

However, some of the records that are extracted do not require processing.

This distinction (to process or not) is dependent on the condition of the value of one of the extracted fields ([cards])

i.e - card values TO process = FRTC0105
BOSC9755
BLAC7603

card values NOT to process = U89999
P28756
(these values are not precise but demonstrate the point i am trying to make)

Therefore i am trying to make a distinction between the second character of the string

i.e IF 2nd character = character THEN process
ELSE (IF 2nd character = num) THEN do not process

IS there a function (similar to datepart()) for strings that will allow me to test the condition of the second character of a text field (or string variable). I am a student and this is my first attempt at visual basic.

Please help

Many thanks

Dave

DJN
02-12-2002, 04:52 AM
Use the Mid and IsNumeric functions to test for characters in the second position in the string.

If Not IsNumeric(Mid([cards],2,1)) then
do the processing
else
exit