logo
search
Others

How to Fix "Record Is Deleted" Error When Clearing a Table in Access

Khadija KhanKhadija Khan Oct 10, 2026 869 views

Question details

The user encounters a "Record is deleted" error while running a macro to clear a temporary table for an inventory report.

How to Fix "Record Is Deleted" Error When Clearing a Table in Access
Product
Microsoft Access
Device & OS
not provided
Scenario
Running an Access macro or VBA code to print an inventory report, which requires clearing out a temporary data table.
Observed behavior
The execution halts, the debugger highlights the DAO Recordset.Delete method, and the system displays a "The record is deleted" error message.
Before you start

Before modifying your database macros or VBA modules, ensure you have created a backup copy of your MS Access database to prevent any accidental data loss.

Solution 1Recommended

Use a SQL DELETE Statement Instead of Recordset.Delete

Replace the DAO Recordset loop with a direct SQL DELETE action query to safely and efficiently empty the entire temporary table.

The DAO Recordset.Delete method is designed to remove only the current row from the active recordset. It does not delete the recordset object itself or empty the underlying table. Attempting to loop through records using this method often results in a "Record is deleted" error if the pointer loses its place.

To properly empty a temporary table, executing a SQL DELETE command is much cleaner. It bypasses the need to loop through individual rows, directly clearing the data and avoiding pointer-related errors.

1
Open the Database Module

Launch your MS Access database and open the VBA editor by pressing Alt + F11, or open the specific macro that is causing the error in Design View.

2
Locate the Error Source

Find the section of your code that loops through the recordset using the DAO Recordset.Delete method to clear the table.

3
Replace with a SQL Statement

Remove the loop and replace it with a SQL execute command. For example, use CurrentDb.Execute "DELETE FROM tbl_Temp_QA_Sheet", dbFailOnError (replace 'tbl_Temp_QA_Sheet' with your actual table name).

4
Save and Test

Save your VBA module or macro. Run your inventory report again to verify that the temporary table clears successfully without triggering the error.

Use a SQL DELETE Statement Instead of Recordset.Delete
Best Practice: Using SQL action queries (like DELETE FROM) is generally much faster and less prone to runtime errors than iterating through recordsets to delete rows one by one.
Free Microsoft Office alternative

Looking for a Reliable Office Suite? Try WPS Office

While Microsoft Access is a specialized database tool, for your everyday document, spreadsheet, and presentation needs, WPS Office provides a free, lightweight, and powerful alternative to Microsoft Office.

  1. 1. Download the Installer: Visit the official WPS Office website and click the free download button to get the latest version.
  2. 2. Install WPS Office: Run the downloaded file and follow the simple on-screen instructions to complete the installation.
  3. 3. Start Creating: Open WPS Office to immediately start working on documents, spreadsheets, and presentations with full Microsoft compatibility.
Fully compatible with Microsoft Word, Excel, and PowerPoint formats (.docx, .xlsx, .pptx).Lightweight installation that runs smoothly even on older devices.Familiar user interface ensuring a seamless migration from Microsoft Office.Built-in PDF toolkit for easy editing, conversion, and signing.
microsoft office alternative - wps office

Frequently Asked Questions

Why does the DAO Recordset.Delete method trigger a 'Record is deleted' error?

This error usually occurs in a loop when the code attempts to reference, manipulate, or delete a record that has already been removed or when the record pointer has not correctly moved to the next valid row using a command like MoveNext.

What is the fastest way to empty a table in MS Access?

The fastest and most efficient way to empty a table is by executing a SQL DELETE query (e.g., DELETE FROM TableName). This processes the deletion at the database engine level instantly, rather than row by row.

Can I recover records deleted by a SQL DELETE statement in Access?

No, once records are deleted using an action query or recordset deletion, they are permanently removed from the table. You can only recover them if you have a prior backup of your database.