Solved

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

Posted on 2011-09-11
5
537 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 34

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 34

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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
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 …

688 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