Solved

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

Posted on 2011-09-11
5
483 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Reproduce the issue with a simple db and attach.
0
 

Author Closing Comment

by:warrenrapson
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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 …

762 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

12 Experts available now in Live!

Get 1:1 Help Now