Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

Is there a way to delete a parent record and all related records to it in access 2007?

Trying to find a way to delete a parent record and all related queries in access 2007. I have a form and put the default delete record button but get an error that states it can't be deleted because of relations (which is expected).

Thanks for the help!
0
jtovar3
Asked:
jtovar3
  • 4
  • 2
1 Solution
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
For the  specific table and it's related tables, to you have Cascade Deleted enabled in that Relationship?

mx
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
and can you post a screenshot of the Relationship for just those tables?

mx
0
 
peter57rCommented:
If you absolutely certain that you would ALWAYS want this to happen then you can set Cascade Delete Related Records in the Relationship definition.

You then just have to delete the parent and all related child records will be deleted as well.

This is an extremely dangerous setting to use.   There is no way to prevent automatic deletions if you adopt this setting so as I said, you must absolutely sure about it.


0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
peter57rCommented:
mmm... the verb 'to be' seems to be missing from my keyboard!!
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
IF ... your business rules allow Deleting records, then have no fear of using Cascade Deletes ... a beautiful thing ... otherwise, you will end up with orphan records.

mx
0
 
jtovar3Author Commented:
Didn't know that there was a cascade feature. Thanks!

Also, thank you Peter for the warning. I will take it under consideration!
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Again. I've never seen an issue with Cascade Deletes or Updates.  If you have related tables AND you allow Deletes in a main table, you need Cascade Deletes turned on.

mx
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now