+ Post New Thread
Results 1 to 3 of 3
Office Software Thread, Access Query - Update SQL statement Help please in Technical; Im trying to write an update query to update multiple records, but the records i want to update criteria is ...
  1. #1

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,521
    Thank Post
    1,333
    Thanked 469 Times in 306 Posts
    Blog Entries
    6
    Rep Power
    199

    Access Query - Update SQL statement Help please

    Im trying to write an update query to update multiple records, but the records i want to update criteria is different for each.

    eg:
    Code:
    UPDATE ASSET SET Location = 'Senior'
    WHERE (((ASSET.[SerialNumber])='1234567890'));
    The above works great but I have a bunch of serial numbers I want to do at once and have been updating the query each time with the next serial but surely theres an easier way?

  2. #2

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,170
    Thank Post
    868
    Thanked 2,698 Times in 2,288 Posts
    Blog Entries
    11
    Rep Power
    772
    I think you can do it via chaining or the OR modifer in full SQL ie
    [code]
    UPDATE ASSET SET Location = 'Senior'
    WHERE (((ASSET.[SerialNumber])='1234567890') OR (ASSET.[SerialNumber])='1234567890'));
    [code]

    You may also be able to try more advanced methods like the ones from here: SQL: UPDATE Statement

    It depends on what version of SQL you are using though, MSSQL is much more powerful than MySQL which is vastly more powerful than Access which takes some single line SQL syntax but not all.

  3. #3


    Join Date
    May 2009
    Posts
    3,013
    Thank Post
    268
    Thanked 796 Times in 603 Posts
    Rep Power
    289
    For one off updates (where there is no point in writing a reusable program), I paste the list (of say serial numbers) into excel, then use the concatenate() function to generate the individual SQL statements. Then copy the text from the resulting column into the SQL client. It takes longer to describe it than it does to do!
    Last edited by pcstru; 26th July 2012 at 08:15 AM.

  4. Thanks to pcstru from:

    RabbieBurns (26th July 2012)

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 0
    Last Post: 28th January 2011, 03:38 PM
  2. SQL - Help please
    By LosOjos in forum Coding
    Replies: 6
    Last Post: 29th March 2010, 09:27 AM
  3. [MS Office - 2007] MS Access query help
    By randle in forum Office Software
    Replies: 7
    Last Post: 9th November 2009, 01:17 PM
  4. Help Please june Update + sql2008
    By woodham in forum MIS Systems
    Replies: 7
    Last Post: 6th July 2009, 03:26 PM
  5. MS Access help please
    By RabbieBurns in forum Office Software
    Replies: 2
    Last Post: 11th December 2008, 02:24 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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