Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 8777 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.