Results 1 to 3 of 3
  1. #1
    hklein is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    15

    Deletion not done due to Error 3086

    Hi, I made a query, which is intended to delete records from tbl Status which doesn't exist tbl Clients. The sql view of the query is like this:
    Code:
     DELETE Status.*, clients.ID FROM Status LEFT JOIN clients ON Status.ID = clients.ID WHERE (((clients.ID) Is Null));
    The syntax seems to be ok, on datasheet view it is shown, which records would be deleted, but when trying to run the query, it is stopped with error 3086 (table is read only etc) Does anybody knows the reason of this? Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    Gets tricky. Requires subquery.

    Google: SQL Delete not match

    Review: http://www.youdidwhatwithtsql.com/up...ther-table/153
    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
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Try this SQL:

    DELETE FROM Status Where Status_ID not in (Select Client_ID from Clients)


    Which says: Delete any records in the Status table where the Status_ID is not found in the list of Clients (Client_ID)

    Just as a thought - are you sure you mean to use Status_ID? Does the Status_ID field really contain a Client number?
    (It's not wrong to do that, but the field name Status_ID normally would be the PK for the Status table)

    John

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

Similar Threads

  1. deletion with join
    By hklein in forum Queries
    Replies: 5
    Last Post: 05-01-2012, 03:41 PM
  2. Replies: 5
    Last Post: 03-27-2012, 01:40 PM
  3. Replies: 2
    Last Post: 02-29-2012, 12:51 AM
  4. Avoid column deletion in datasheet
    By dinorbaccess in forum Forms
    Replies: 6
    Last Post: 12-29-2010, 03:08 PM
  5. Time Stamp Removal/deletion?
    By thorsonb in forum Access
    Replies: 3
    Last Post: 03-30-2010, 10:17 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