Solved

Unable to delete record from a main Access table linked to two tables

Posted on 2011-09-11
5
507 Views
Last Modified: 2013-11-28
Hi Guys,

I have an Access DB (Action) Query with two 3 tables. The first (main) table is linked to two tables.  The query displays the code from the main table and the rest of the two columns come from the second and third tables.

When I pressed the Delete button on a record in the query grid, the record gets removed from the grid and prompted "You are about to delete 1 record(s)".  Selecting "Yes" goes back to the grid and the deleted record is not displayed.

But closing and re-loading the script, the deleted record still exists.  Why is the Delete action was not applied in the database.  

I can edit the query column for the record from the secord and third tables without any issue.  Edited value persist next time the query is re-loaded.

Thanking you in advance.

0
Comment
Question by:warrenrapson
5 Comments
 
LVL 13

Assisted Solution

by:khairil
khairil earned 167 total points
ID: 36520925
Hi,

Try check table relationship, record will not be deleted if there is reference in other table and relationship does not set to cascade delete.
0
 
LVL 33

Accepted Solution

by:
Mike Eghtebas earned 333 total points
ID: 36839808
In deleting data involving number of tables, you have to either:

1. Delete the related data in tables with FK and then delete the record in the table with PK.

2. In table relationship screen right click on the relationship lines between these three tables, select edit. Then enforce cascade on delete option.

Mike
0
 
LVL 33

Assisted Solution

by:Mike Eghtebas
Mike Eghtebas earned 333 total points
ID: 36840705
If database allows you to delete records from table with PK, then you will have orphan records left in the other tables and this is considered violation of database referential integrity.

Mike
0
 
LVL 30

Expert Comment

by:hnasr
ID: 36914698
Reproduce the issue with a simple db and attach.
0
 

Author Closing Comment

by:warrenrapson
ID: 37863763
Thanks guys, I was sidetracked by various projects.  The temporary solution I implemented was a code-behind the delete record event of the grid and deleted the record with an sql script.  

Given such response, I believe each one had merits an as such I accept multiple solutions.

Thanks again...

Cheers.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

806 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