Results 1 to 5 of 5
  1. #1
    seawulf is offline Novice
    Windows 7 32bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    4

    Deleting associated data across multiple tables

    I have two tables, one contains customer data, and when we contact our customers we save call history notes to another table. I'd like to remove customer data from the primary table and somehow delete all associated call history notes from the other table.



    I've been asked to do this but when I google for instructions it makes my head want to explode and I know there is an easy way to delete this data because no one would use access if you had to do it one at a time.

    Any help would be appreciated!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    You can set up cascade deletes in referential integrity in the relationships window. Or if you have a delete button on a form, you can run a delete query that deletes data from the calls table using the customer on the form as a criteria, then let it delete the customer. The first is more "bullet proof", as no matter how a user might delete a customer, the calls will get deleted.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    Use Relationships. Database Tools> Relationships, Add your 2 tables and link the connecting fields (CustomerID maybe?). When box comes up Select to Enforce Referential Integrity and select Update and Delete check boxes. Then when you delete a Customer in the main table, all notes from history table will be deleted for that Customer.

  4. #4
    seawulf is offline Novice
    Windows 7 32bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    4
    This did the trick! I get sick of following really terrible instructions I find on the web that never answer what I know are simple(at least not difficult) questions. Your help here today is really direct and refreshing. Thanks!

  5. #5
    NightWalker's Avatar
    NightWalker is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2016
    Location
    Midwest USA
    Posts
    253
    Why would you want to delete items like that out of a DB. You will lose all ability to track historical data. I am not understanding why someone would do that.

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

Similar Threads

  1. deleting from multiple tables
    By rameshjctr in forum Forms
    Replies: 3
    Last Post: 03-23-2016, 08:20 AM
  2. Replies: 6
    Last Post: 08-17-2014, 06:14 PM
  3. Deleting old tables
    By crowegreg in forum Programming
    Replies: 1
    Last Post: 09-06-2013, 11:03 AM
  4. Replies: 5
    Last Post: 08-12-2013, 12:53 AM
  5. Replies: 1
    Last Post: 08-25-2012, 06: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