Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Minnesota, USA
    Posts
    151
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Replacing leading number in a field value - Access 2010

    I have an account number field with values of varying lengths (8 to 20+ digits). I have a series of values that currently start with the number 1 that I need to change to a 2. The values are in a table in the local database. It's currently about 45,000 records and the update process needs to be repeatable.

    I know it should be a simple update query, but am drawing a blank about how to get it to change just that first digit.

    Any suggestions are welcome.

    Thanks!

    Nancy

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts
    UPDATE yourtable SET AccountNumber = "2" & mid(AccountNumber,2) WHERE Left(AccountNumber,1)="1"

    Of course, backup your database before doing something so drastic.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Minnesota, USA
    Posts
    151
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you, Mark! It worked perfectly.

    I appreciate your help.

    Nancy

Posting Permissions

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