Kay Posted November 10, 2000 Posted November 10, 2000 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
Chuck Posted November 11, 2000 Posted November 11, 2000 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
Kay Posted November 14, 2000 Author Posted November 14, 2000 Thank you, thank you! It works great. Kay.
Recommended Posts
This topic is 8777 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now