Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Maine, USA
    Posts
    258
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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

  2. #2
    Star Lounger
    Join Date
    Aug 2001
    Location
    Seattle, Washington, USA
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    Try using the Left() function.

    Something like <font color=blue>Left([MyPostalCode],5)</font color=blue> 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

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

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

    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.

  4. #4
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

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

    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.
    Regards,

    Gary
    (It's been a while!)

  5. #5
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Maine, USA
    Posts
    258
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •