• Remove hyphens to store SSN as number (Access2K)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Remove hyphens to store SSN as number (Access2K)

    Author
    Topic
    #422912

    One of the fields in a legacy table stores SSN as text (999-99-9999). A field in the new table stores SSN as number(999999999). I need to move the text ssn into a field in the new table as number. How can I convert the text SSN into number format i.e. how do I get rid of the hyphens?

    Viewing 1 reply thread
    Author
    Replies
    • #965930

      Create a query, and use the following expression to populate the new SSN field:

      CLng(Left([OldSSN],3) & Mid([OldSSN,5,2) & Right([OldSSN],4))

      where OldSSN is the name of the text field.

    • #965952

      You may want to consider storing SSN as a text field

      You will loose leading zeros and have problems with sorting by SSN down the road.

      Create a query, and use the following expression to populate the new SSN field:

      Left([OldSSN],3) & Mid([OldSSN,5,2) & Right([OldSSN],4))

      HTH, John

    Viewing 1 reply thread
    Reply To: Remove hyphens to store SSN as number (Access2K)

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

    Your information: