Results 1 to 4 of 4
  1. #1
    dhutton27 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    9

    Combine several update queries into one Access 2010

    Hello,
    Have a question about using an update query in Access 2010. I am updating new columns in my database. The two queries below work just fine. How can I combine the two - together so I can run it once instead of having to run each one separate?






    UPDATE SalesOrderHeader INNER JOINSalesPerson
    ON SalesOrderHeader.SalesPer = SalesPerson.SalesPer
    SET SalesOrderHeader.SalesPerID = SalesPerson.SalesPerID;

    ================================================== ==========

    UPDATE SalesOrderHeader INNER JOINJobDesc
    ON SalesOrderHeader.JobDesc =JobDesc.JobDesc
    SET SalesOrderHeader.JobDescID =JobDesc.JobDescID








  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Can try a query that joins SalesPerson and JobDesc to SalesOrderHeader. Don't use INNER JOIN - use 'Include all records from SalesOrderHeader ...' (LEFT or RIGHT).

    Why is this necessary? Why is the descriptive info saved in the first place instead of the ID's? Will this be a regular event or just a one-time edit to fix tables? If it's a one-time event, why the concern about running each individually? Just do it and get it done.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    dhutton27 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    9
    Quote Originally Posted by June7 View Post
    Can try a query that joins SalesPerson and JobDesc to SalesOrderHeader. Don't use INNER JOIN - use 'Include all records from SalesOrderHeader ...' (LEFT or RIGHT).

    Why is this necessary? Why is the descriptive info saved in the first place instead of the ID's? Will this be a regular event or just a one-time edit to fix tables? If it's a one-time event, why the concern about running each individually? Just do it and get it done.

    Yes - your right, could just run it once and be done with it. I have 5 columns to update and thought there might be an easier way and just write one query for all 5. Any way you could give me an example using the 'Include all as you mentioned. Do you mean I can use either a Left or Right Join?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Can update as many fields as you want in single UPDATE action. The complication is that the source data is from multiple tables. As long as these are lookup tables should be okay.

    Use query builder to first build the SELECT that joins tables then click UPDATE. Click on line that links tables and set the join as described. Result should be LEFT or RIGHT (not sure which one you will end up with).
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 01-07-2016, 12:49 PM
  2. Ms Access 2010 queries
    By ITsavy in forum Access
    Replies: 3
    Last Post: 06-20-2014, 05:53 AM
  3. How do I combine these two queries?
    By racefan91 in forum Queries
    Replies: 18
    Last Post: 10-19-2013, 12:54 PM
  4. Combine Queries
    By Steven.Allman in forum Queries
    Replies: 9
    Last Post: 08-30-2010, 12:13 PM
  5. Combine 3 Queries
    By Logix in forum Queries
    Replies: 1
    Last Post: 06-10-2010, 06:03 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums