How to safely delete linked records in Access (1 Viewer)

howling_muffin

New member
Local time
Today, 15:07
Joined
Jul 29, 2020
Messages
11
I'm creating a database in Access and VBA, and I'm trying to figure out how to delete records correctly and safely.
What I'm trying to do is simply delete a record and all its foreign key'd records cleanly, without #Deleted showing up in the table.

There doesn't seem to be any documentation on this, and I'd really appreciate some professional advice seeing as it's my first foray into VBA and databases and I'm sort of hacking my own path.
 

bob fitz

AWF VIP
Local time
Today, 15:07
Joined
May 23, 2011
Messages
4,727
If you have enforced "Referential Integrity" and "Cascade Delete Related Records" in your relationship then related records one the many side will be deleted by access when you delete a record on the one side.
Tables should be used to store data rather than Add/Edit it.
The #Deleted that you see can be removed by performing a requery when editing using a form.
With a table I think you would need to close and reopen it.
Once in use it might be better to flag a record as no longer needed rather than actually deleting it.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 15:07
Joined
Feb 19, 2013
Messages
16,617
or you can sort or filter the table which forces a requery
 

Users who are viewing this thread

Top Bottom