Results 1 to 7 of 7
  1. #1
    New Lounger
    Join Date
    Jan 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Microsoft Access 2010 update query

    Hi, I'm wondering if someone can help me out. I've got about 2500 records with serial numbers (stored as text) I would like to update/append.

    I want to change the leading 1 in a serial number to a 2 (the length will vary to a maximum of 10 digits). The serial number is stored in the field named SERIAL and in the table named CUST_INF.

    Could someone kindly point me in the right direction?

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    6,477
    Thanks
    211
    Thanked 849 Times in 781 Posts
    L.F.,

    Welcome to the Lounge as a new poster!

    This should do the trick:
    Table Before:
    AccessBefore.JPG
    Update Query: (click on graphic to enlarge and make readable)
    UpdateQuery.JPG
    Table After:
    AccessAfter.JPG
    HTH
    May the Forces of good computing be with you!

    RG

    VBA Rules!

    My Systems: Desktop Specs
    Laptop Specs


  3. #3
    New Lounger
    Join Date
    Jan 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by RetiredGeek View Post
    L.F.,

    Welcome to the Lounge as a new poster!

    This should do the trick:
    Table Before:
    AccessBefore.JPG
    Update Query: (click on graphic to enlarge and make readable)
    UpdateQuery.JPG
    Table After:
    AccessAfter.JPG
    HTH
    Thank you, that worked like a charm. Now, just for future reference, assuming I've got a number I want to change besides 1. For example, if I want to go from a 7 to a 2. What would I change in my query? Also, would I be able to make the changes and execute the query or do I need to close the database and start from scratch with the new information?

  4. #4
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    6,477
    Thanks
    211
    Thanked 849 Times in 781 Posts
    L.F.

    You can change the existing update query as follows:

    Criteria:
    From: Left([Serial],1)="1"
    To: Left([Serial],1)="7"

    Interestingly when I went back into the query I saved it had changed the query to:
    UpdateQuery.JPG
    It does the same thing just a different syntax. This is in Access 2010 BTW. HTH
    May the Forces of good computing be with you!

    RG

    VBA Rules!

    My Systems: Desktop Specs
    Laptop Specs


  5. #5
    New Lounger
    Join Date
    Jan 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by RetiredGeek View Post
    L.F.

    You can change the existing update query as follows:

    Criteria:
    From: Left([Serial],1)="1"
    To: Left([Serial],1)="7"

    Interestingly when I went back into the query I saved it had changed the query to:
    UpdateQuery.JPG
    It does the same thing just a different syntax. This is in Access 2010 BTW. HTH
    So if I'm using this database with another application is there anything I need to do aside from overwriting the live database with the modified copy? I am assuming I don't need to build anything, etc.?

  6. #6
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    6,477
    Thanks
    211
    Thanked 849 Times in 781 Posts
    L.F.,

    That should do the trick.
    May the Forces of good computing be with you!

    RG

    VBA Rules!

    My Systems: Desktop Specs
    Laptop Specs


  7. #7
    New Lounger
    Join Date
    Jan 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Quote Originally Posted by RetiredGeek View Post
    L.F.,

    That should do the trick.
    Everything worked perfectly, thank you!

Posting Permissions

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