Results 1 to 3 of 3
  1. #1
    jabrjo is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Nov 2014
    Posts
    33

    Single delete button for multiple tables on form and subform

    I would like to create a button that deletes records from both the form and the subform. I currently have two delete buttons on the from but it looks a little confusing. I'm assuming I would have to tweak the code behind the button but have no idea where to start. Any help would be greatly appreciated!



    Thanks

  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,722
    You delete records from tables. Typically a form/subform is set up when 2 tables have a 1 to many relationship.
    In general, using a Person has Many Hobbies as 2 tables in a 1 to many relationship, if you want to delete the Person you
    would delete the Person and their related Hobbies.

    You can set up to do this by setting up Cascade Delete on the relationship.
    You may want to do a little research on MS Access Cascade Delete.

    However, many developers would suggest an approach where you never do physical deletes in databases.
    You have a boolean (yes/No) field in your tables that is used to signal whether this record is "logically deleted".
    If the field value is True, then the record is "deleted". The issue with this approach is that you have to respect the
    field in all queries etc. The benefit is that you never lose a historical record.

  3. #3
    jabrjo is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Nov 2014
    Posts
    33
    Thanks Orange. I'll see what i cant find!

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

Similar Threads

  1. single form for multiple subform controls
    By vientito in forum Programming
    Replies: 1
    Last Post: 11-06-2014, 07:25 PM
  2. Replies: 1
    Last Post: 09-16-2014, 02:26 PM
  3. Delete Entry from subform using button
    By jobatiikanawong1987 in forum Access
    Replies: 1
    Last Post: 08-08-2013, 11:37 AM
  4. calling multiple reports from single form button
    By lugnutmonkey in forum Reports
    Replies: 3
    Last Post: 01-02-2013, 02:28 PM
  5. Form with single record but multiple tables
    By thegooser in forum Forms
    Replies: 1
    Last Post: 10-10-2012, 01:48 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