Solved

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

Posted on 2011-09-11
5
496 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
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 …

932 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

16 Experts available now in Live!

Get 1:1 Help Now