How to Find and Audit Unexpectedly Deleted Records in Microsoft Access
Question details
The user needs to investigate why database records are disappearing and create an audit log to capture details of any deleted records for future tracking.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Setting up a database tracking mechanism to monitor and log unauthorized or unexpected record deletions.
- Observed behavior
- Records are being deleted unexpectedly from the database, and there is currently no way to see what data was removed or track the deletion events.
Before configuring an After Delete data macro, ensure your target Access table is saved, closed, and that you have administrative privileges to modify table design and macro logic.
Create an Audit Table and After Delete Data Macro
Set up an audit table to capture deleted information automatically using an After Delete data macro.
To track deletions, you need a separate destination table (the audit table) and a data macro triggered directly at the table level. This ensures deletions are logged regardless of whether they occur via a form, a query, or directly in the table view.
Create a new table in Access named 'AuditLog'. Add fields to store the deleted data, such as the original fields from your main table, along with 'DeletedDate' and 'DeletedBy'.
Right-click the main table where records are being deleted unexpectedly and select 'Design View'.
In the Table Design ribbon, click on 'Create Data Macros' and select 'After Delete'.
Use the 'Create a Record In' block and select your 'AuditLog' table. Add 'SetField' actions for each column. Crucially, reference the deleted values from the original table using the [Old].[FieldName] syntax (e.g., [Old].[CustomerID]).

Investigate Components Causing Unintended Deletions
Review database objects and user behaviors that might be triggering deletions without explicit knowledge.
Looking for a Lightweight Office Suite? Try WPS Office
While WPS Office does not include a direct relational database replacement for Microsoft Access, it is an excellent, free alternative for handling word processing, spreadsheets, and presentations. You can easily track data, maintain lists, and analyze exported database records using WPS Spreadsheet's advanced filtering and tracking features.
- 1. Download WPS Office: Visit the official WPS website and download the free WPS Office suite for your operating system.
- 2. Import Your Data: Export your Access data as a CSV or Excel file, then open it in WPS Spreadsheet for easy tracking.
- 3. Enable Track Changes: Use the Review tab to protect your sheet and track any future modifications to prevent unexpected data loss.

Frequently Asked Questions
Why is my After Delete data macro logging blank records?
This happens when the macro attempts to reference the standard field name of a deleted record. You must explicitly use the [Old].[FieldName] syntax (e.g., [Old].[EmployeeName]) so Access knows to retrieve the value from the deleted state.
Can an After Delete macro track who deleted the record?
Yes. In your 'Create a Record In' block inside the data macro, you can add a 'SetField' action for your 'DeletedBy' field and set its value to the CurrentUser() function or a custom Windows login capture variable if configured.
Is it possible to recover records that were deleted before I created the audit macro?
No, data macros only trigger for actions taken after they are implemented. To recover previously deleted records, you must restore a prior backup of the Access database.
Do cascade deletes trigger After Delete data macros?
Yes. If a parent record is deleted and cascade delete removes related child records, the After Delete macro on the child table will execute for each deleted child record.




