November 10, 200025 yr Howdy, I would like to ensure users type in a valid Canadian postal code into a field. They are formatted like this: A9A 9A9 (Alpha-Number-Alpha-Space-Number-Alpha-Number) e.g. M5N 2E8 Can anyone point me in the right direction? I don't want to break it into a million separate fields. Thanks & Regards, Kay PS Using v4 on MAC
November 11, 200025 yr Position( "ABCDEFGHIJKLMNOPQRSTUVWXYZ", Left( postal code, 1 ), 1, 1 ) and Position( "0123456789", Middle( postal code, 2, 1 ), 1, 1 ) and Position( "ABCDEFGHIJKLMNOPQRSTUVWXYZ", Middle( postal code, 3, 1 ), 1, 1 ) and Middle( postal code, 4, 1 ) = " " and Position( "0123456789", Middle( postal code, 5, 1 ), 1, 1 ) and Position( "ABCDEFGHIJKLMNOPQRSTUVWXYZ", Middle( postal code, 6, 1 ), 1, 1 ) and Position( "0123456789", Right( postal code, 1 ), 1, 1 ) This calculation will return 1 if the postal code conforms to Canadian standards and 0 if it doesn't Chuck
Create an account or sign in to comment