June 1, 200619 yr 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?
June 1, 200619 yr a new calc field that combines the two you need: Field1 &"-"& field2 where field1= first 5 of zip where field2= last 4 of zip
June 1, 200619 yr 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
June 1, 200619 yr 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
June 2, 200619 yr Author Thanks, Martha. That did it. Lee I tried adding your suggestion to Martha's but couldn't get it to work.
June 2, 200619 yr 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
Create an account or sign in to comment