Results 1 to 3 of 3
  1. #1
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370

    Question Delete Query Help

    Hello all,

    The breakdown: I have two tables, Table1, and Table2. Table2 is linked to Table1 by a one to many relationship, meaning Table2 has a foreign key(multiple Table2 records for one Table1 record).

    In Table1 I have a Yes/No field named [Completed].

    I have a delete query that runs through Table 1 and deletes records that have [Completed] checked as "Yes."

    The problem:
    I'm trying to make another delete query that runs on Table2, and deletes the records that are linked to Table1 that has the field [Completed] checked "Yes"

    Any help would be great!



    Thanks

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Try setting Enforce Relational Integrity and Cascade Delete in Relationships builder. See if the related records in Table2 automatically delete when records in Table1 are deleted with the action SQL.

    Otherwise, delete the records in Table2 first. The query will have to join the two tables so the Completed field will be available as filter criteria.

    Why delete records?
    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
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370
    Thanks June7, the Cascade Delete did the trick.

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

Similar Threads

  1. Replies: 6
    Last Post: 12-03-2014, 10:28 PM
  2. Delete query
    By AlexSalvadori in forum Queries
    Replies: 2
    Last Post: 11-16-2012, 11:09 AM
  3. Replies: 2
    Last Post: 01-24-2012, 02:16 PM
  4. Trying to Delete record using delete query
    By MooseOTL in forum Access
    Replies: 13
    Last Post: 10-04-2011, 02:30 AM
  5. Replies: 11
    Last Post: 03-30-2011, 01:08 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