ajnhlr Posted June 1, 2006 Posted June 1, 2006 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?
James_bk Posted June 1, 2006 Posted June 1, 2006 a new calc field that combines the two you need: Field1 &"-"& field2 where field1= first 5 of zip where field2= last 4 of zip
mz123 Posted June 1, 2006 Posted June 1, 2006 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
Lee Smith Posted June 1, 2006 Posted June 1, 2006 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
ajnhlr Posted June 2, 2006 Author Posted June 2, 2006 Thanks, Martha. That did it. Lee I tried adding your suggestion to Martha's but couldn't get it to work.
Lee Smith Posted June 2, 2006 Posted June 2, 2006 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
Recommended Posts
This topic is 6811 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