Solved insert into table after delete (1 Viewer)

data_guy

New member
Local time
Today, 11:44
Joined
Jun 3, 2019
Messages
6
hello,

I want any deleted record from an access table to be inserted into another table. This second table will capture all my deletions. some assistance on how to go about it will be much appreciated. thanks
 

NauticalGent

Ignore List Poster Boy
Local time
Today, 06:44
Joined
Apr 27, 2015
Messages
6,337
Hello and welcome to AWF. Although what you want to do is possible, the better way to do this is to have a field in your table that flags a record as deleted and then use a query to include/exclude them as needed.
 

plog

Banishment Pending
Local time
Today, 05:44
Joined
May 11, 2011
Messages
11,646
Agree with Nautical. This isn't how databases are to work. Data isn't supposed to be moved around different tables; its to be related and designated. You simply add an [InActive] field to a record and when set to True it represents deleted.

Perhaps you can explain what real world process you are modeling in your database and give the reasoning for why a record would be deleted, but not deleted deleted.
 

data_guy

New member
Local time
Today, 11:44
Joined
Jun 3, 2019
Messages
6
Thank you Nautical, I think your better option solves my issue. i just want a way of keeping track of records not needed again. flagging them and excluding them in queries will help. 🤝
Hello and welcome to AWF. Although what you want to do is possible, the better way to do this is to have a field in your table that flags a record as deleted and then use a query to include/exclude them as needed.
 

data_guy

New member
Local time
Today, 11:44
Joined
Jun 3, 2019
Messages
6
Agree with Nautical. This isn't how databases are to work. Data isn't supposed to be moved around different tables; its to be related and designated. You simply add an [InActive] field to a record and when set to True it represents deleted.

Perhaps you can explain what real world process you are modeling in your database and give the reasoning for why a record would be deleted, but not deleted deleted.
thanks plog. I'm not deleting any records per your advice. you've shown me the better way

i was looking at a situation where a user inputs incorrect data in a record or a customer table where a customer is deceased. in that instance, these records need to be deleted from the table but backed up in another table. however, you've taught me better. thank you.🤝
 

CJ_London

Super Moderator
Staff member
Local time
Today, 11:44
Joined
Feb 19, 2013
Messages
16,610
Just a suggestion but rather than using a yes no field use a date field. If populated then the record is ‘deleted’. Benefit is it gives a ‘when’ a record is no longer to be referenced. This matters if you are doing historical analysis such as monthly or annual comparison of record numbers or you want a record to be ignored at some point in the future for example
 

Users who are viewing this thread

Top Bottom