Hi - I just need to know how to validate alphanumberic code in MS Access. I can validate numeric information (zip codes), but I can't seem to get the correct code to validate alphanumeric (Canada postal codes). Code in red is what does not work.
'Verify Edmonton Postal Codes
If Not IsNull(City) And Not IsNull(PostalCo de) Then
PostalCodeFirst Two = Val(Left(Postal Code, 2))
Select Case City
Case "Edmonton"
If Not (PostalCodeFirs tTwo Like "T5" Or PostalCodeFirst Two Like "T6") Then
MsgBox "Edmonton Postal Codes should begin with T5 or T6"
GoTo CommonProcessin g
End If[/U][/U] End Select
End If
Exit Sub
CommonProcessin g:
DoCmd.CancelEve nt
Me.Undo
PostalCode.SetF ocus
End Sub
'Verify Edmonton Postal Codes
If Not IsNull(City) And Not IsNull(PostalCo de) Then
PostalCodeFirst Two = Val(Left(Postal Code, 2))
Select Case City
Case "Edmonton"
If Not (PostalCodeFirs tTwo Like "T5" Or PostalCodeFirst Two Like "T6") Then
MsgBox "Edmonton Postal Codes should begin with T5 or T6"
GoTo CommonProcessin g
End If[/U][/U] End Select
End If
Exit Sub
CommonProcessin g:
DoCmd.CancelEve nt
Me.Undo
PostalCode.SetF ocus
End Sub
Comment