Results 1 to 5 of 5
  1. #1
    Rafegh is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2014
    Posts
    13

    Delete Query Doesnt work!


    Hi
    I have created a delete query. As I click datasheet view it shows the records matching the criterion that I have defined. But when I want to Run it, it doesn't run and views the message "Could not delete from specified tables." !
    I have checked my document and it is not Read-only! How can I solve this problem?

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Post the SQL of the delete query involved.
    Tell us more about your tables and relationships.
    You may wish to research referential integrity

    Good luck

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    It could also be a query that can only delete via an IN sub query, where the matching codes are in the sub-query.

    Click image for larger version. 

Name:	delete in.png 
Views:	10 
Size:	12.1 KB 
ID:	17748

  4. #4
    Rafegh is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2014
    Posts
    13
    This is my sql code:
    DELETE NoSamples.*, NoSamples.ProjectCode, NoSamples.SectionNo
    FROM Temp INNER JOIN NoSamples ON (Temp.SectionNo = NoSamples.SectionNo) AND (Temp.ProjectCode = NoSamples.ProjectCode);

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,623
    No need to enumerate fields because DELETE removes entire record.

    Maybe:

    DELETE FROM NoSamples INNER JOIN ON Temp.SectionNo=NoSamples.SectionNo AND Temp.ProjectCode=NoSamples.ProjectCode;

    Why do you need to delete records? Deleting records should be a rare event.
    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. Add new Record button doesnt work
    By zmbaker in forum Forms
    Replies: 1
    Last Post: 07-25-2014, 03:28 PM
  2. NZ() doesnt work for date range
    By tagteam in forum Access
    Replies: 3
    Last Post: 03-12-2014, 11:10 AM
  3. Web DB Subform drag&drop doesnt work
    By Stefan in forum Forms
    Replies: 6
    Last Post: 11-27-2012, 01:42 PM
  4. Query runs fine but report doesnt work
    By endri81 in forum Queries
    Replies: 4
    Last Post: 04-28-2012, 02:35 PM
  5. Help I dunno y it doesnt work
    By zaza123 in forum Programming
    Replies: 7
    Last Post: 07-03-2011, 06:43 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