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
216 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 - Microsoft MVP, Access and Data Platform) 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

679 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