Results 1 to 5 of 5
  1. #1
    Douglasrac is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    92

    Question Update 2 tables with one Update Query


    Here is what I did:

    UPDATE TableName, TableName2
    SET FieldName = TRUE And FieldName2 = True
    WHERE ((FieldName = False) AND (FieldName2 = False))

    But didn't work. And as I read, Access can't run multiple statements in one query. So I need to found another solution. Why the code above does not work?

  2. #2
    Rixxe is offline Blessed Bear
    Windows 7 Access 2007
    Join Date
    Sep 2010
    Location
    London (Essex ... yep!)
    Posts
    184
    Why can you just not run two seperate queries?

    I don't understand why you would need to do this.

  3. #3
    Rixxe is offline Blessed Bear
    Windows 7 Access 2007
    Join Date
    Sep 2010
    Location
    London (Essex ... yep!)
    Posts
    184
    This might do it:

    UPDATE Table1 INNER JOIN Table2 ON Table1.ID = Table2.ID SET Table1.ID ="200",
    Table2.ID = "200" WHERE Table2.ID="1000"

  4. #4
    Douglasrac is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    92
    Quote Originally Posted by Rixxe View Post
    This might do it:

    UPDATE Table1 INNER JOIN Table2 ON Table1.ID = Table2.ID SET Table1.ID ="200",
    Table2.ID = "200" WHERE Table2.ID="1000"
    Because its seems such a simples task, so I don't want to make 2 very simples queries to do one simple task.

    I don't understand the numbers. 200 and 1000. What that's suppose to be?

  5. #5
    Rixxe is offline Blessed Bear
    Windows 7 Access 2007
    Join Date
    Sep 2010
    Location
    London (Essex ... yep!)
    Posts
    184
    Its an example, you can just replace:

    Table1.ID ="200"

    with

    TableName.FieldName = TRUE

    Just change it accordingly and try the query out and see if it works... and just FYI sometimes doing it the simple way isn't a bad thing.
    You could go round the houses to update a table, or just do it the easy way and save yourself time.

    Maybe someone else might have an idea.

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

Similar Threads

  1. Replies: 1
    Last Post: 01-22-2011, 12:23 PM
  2. Update Query that uses fields from other tables?
    By DarrenReeder in forum Queries
    Replies: 1
    Last Post: 12-06-2010, 10:47 AM
  3. Update Query- selective update?
    By stephenaa5 in forum Queries
    Replies: 1
    Last Post: 10-29-2009, 11:15 AM
  4. update tables via forms
    By jazoo in forum Forms
    Replies: 0
    Last Post: 09-16-2008, 05:54 AM
  5. Update Tables
    By lschlitt in forum Programming
    Replies: 2
    Last Post: 05-28-2006, 02:11 PM

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