• how to strip +four from US Zip Codes (2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » how to strip +four from US Zip Codes (2000)

    Author
    Topic
    #378247

    Hello,
    I need a little bit of code that will strip the dash and the last four digits from US Zip Codes, so that all I have left is the five digit zip. I think I know what to do with the code once I have it – I just need the single line that actually deletes those five characters. Thanks!
    -cynthia

    Viewing 2 reply threads
    Author
    Replies
    • #625402

      Try using the Left() function.

      Something like Left([MyPostalCode],5) will return the first five characters (counting from the left) of MyPostalCode.

      Change the name of the field to the one you’re using.

      HTH,

      Tom

    • #625403

      Perhaps, you can use something along the lines of

      =Left([ZipField], 5)

      in an expression, or

      Function Zip5(aZip)
      Zip5 = Left(aZip, 5)
      End Sub

      in a module.

    • #625404

      Do all of your zip codes always contain the dash and last four characters? If not, the answers below may not be of much help.

      • #625422

        Thank you!
        The only zips which were causing me problems were those with the extra five characters – so I’ve done a query to find those and will put the extra digits in a separate field and strip it out of the zip field for those records.
        thanks again,
        -cynthia

    Viewing 2 reply threads
    Reply To: how to strip +four from US Zip Codes (2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: