Jump to content

9 digit zip code


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

Recommended Posts

This is bound to be on here somewhere, but I can't find it after doing several searches. How do I get a zip code field to produce XXXXX-XXXX if the last 4 digits are entered and just the first 5 digits without the - if that's all that's entered?

Link to comment
Share on other sites

you could also do an auto-calc (with replace) for your zip code field:

If(PatternCount(ZipCode; "-") = 0; Left(ZipCode; 5) & "-" & Right(ZipCode; 4); ZipCode)

This will automatically replace the user's input once they exit the field.

Martha

Link to comment
Share on other sites

I like to use the Auto Enter as Martha has posted.

However, you need to modify your calculation so that the = sign doesn't get included if the field 2 doesn't have data. something like this:

Case ( IsEmpty ( Zip_4 ) ; Zip_5 ; Zip_5 & "-" & Zip_4 )

HTH

Lee

Link to comment
Share on other sites

The reason that didn't work, is they are two different approaches to the same thing.

I took a 3 field approach, because James had provide a calculation for that aproach. What I added was the part to check for a value before posting. Whereas, Martha took a advantage of a change in the Auto Enter Calculation, that allows the calculation to be done in one field.

However, I like the calculation that Matt Willis provided on FMExperts List.

Lee

Link to comment
Share on other sites

This topic is 5657 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
 Share

×
×
  • Create New...

Important Information

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