Solved

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

Posted on 2011-02-28
7
215 Views
Last Modified: 2012-05-11
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
Comment
Question by:jtovar3
  • 4
  • 2
7 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 500 total points
ID: 34999225
For the  specific table and it's related tables, to you have Cascade Deleted enabled in that Relationship?

mx
0
 
LVL 75
ID: 34999236
and can you post a screenshot of the Relationship for just those tables?

mx
0
 
LVL 77

Expert Comment

by:peter57r
ID: 34999255
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 77

Expert Comment

by:peter57r
ID: 34999265
mmm... the verb 'to be' seems to be missing from my keyboard!!
0
 
LVL 75
ID: 34999599
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
 

Author Closing Comment

by:jtovar3
ID: 34999725
Didn't know that there was a cascade feature. Thanks!

Also, thank you Peter for the warning. I will take it under consideration!
0
 
LVL 75
ID: 34999831
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now