if..then...end if

R

renold1958

have a form with fields CustID and AreaCode
ie:
CustID AreaCode
1BH0001 2
1BH0002 2

2BH0001 3

what I like to do is with the if..then etc is:

If CustID = 1BH (then any 3 numbers) then
AreaCode = 2
Else If CustID = 2BH (any 3 numbers) then
AreaCode =3

etc etc
End If

Is there any symbol I can use, so it doesn't matter which 3 numbers I use,
aslong as the first number and subsequent 2 numbers are the same, that the
corresponding AreaCode is automatically filled in?
 
O

Ofer

Try using the Like in the IF

If CustID Like "1BH*" then
AreaCode = 2
Else
If CustID Like "2BH*" then
AreaCode =3
end if
End If
etc etc
End If
 
Top