Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Mar 2003
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Remove hyphens to store SSN as number (Access2K)

    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?

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

    Re: Remove hyphens to store SSN as number (Access2K)

    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.

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Remove hyphens to store SSN as number (Access2K)

    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

Posting Permissions

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