Results 1 to 4 of 4
  1. #1
    Lady_Jane is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2010
    Location
    Canada
    Posts
    49

    Question Update query using NOT IN

    Hi everyone,
    Here is the query I am trying to run:
    Code:
    UPDATE tbl_CatchmentsCSL
    SET NoWasteSites = "Yes"
    WHERE UID NOT IN (SELECT UID FROM tbl_PointStressorsLKP) AND Study = "SEO"
    This is giving me a "must use an updateable query" error. From googling I understand that this is because you cannot update using a subquery, but I do not know a way around it.

    Suggestions?


    Thank-you!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Try DLookup

    UPDATE tbl_CatchmentsCSL
    SET NoWasteSites = "Yes"
    WHERE DLookup("UID","tbl_PointStressorsLKP","UID=" & [UID]) Is Null AND Study = "SEO"
    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
    Lady_Jane is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2010
    Location
    Canada
    Posts
    49
    Thanks,
    That's what I was looking for, I just didn't know how to get the DLookup equivalent of NOT IN.
    I ran the query, however, and it says "unknown"...?

  4. #4
    Lady_Jane is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2010
    Location
    Canada
    Posts
    49
    Figured it out: there was an issue with the quotes. [UID] is a string, so I converted the Query to:
    Code:
    UPDATE tbl_CatchmentsCSL SET NoWasteSites = "Yes"
    WHERE DLookup("[UID]","tbl_PointStressorsLKP","[UID]='" & [UID]&"'") Is Null And Study="SEO";
    and it works

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

Similar Threads

  1. Select Query > Update Query > Table Field
    By tuggleport in forum Queries
    Replies: 2
    Last Post: 08-09-2012, 07:04 AM
  2. Replies: 1
    Last Post: 08-19-2011, 12:16 PM
  3. Update 2 tables with one Update Query
    By Douglasrac in forum Queries
    Replies: 4
    Last Post: 04-14-2011, 08:33 AM
  4. Replies: 2
    Last Post: 01-31-2011, 08:31 AM
  5. Update Query- selective update?
    By stephenaa5 in forum Queries
    Replies: 1
    Last Post: 10-29-2009, 11:15 AM

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