Others

How to Fix an Access Delete Query That Deletes Zero Records

John WilsonJohn Wilson Nov 3, 2026 868 views

Question details

The user needs to resolve an issue where an Access DELETE query fails to remove any records when utilizing date-based subqueries.

How to Fix an Access Delete Query That Deletes Zero Records
Product
Microsoft Access
Device & OS
not provided
Scenario
Attempting to execute a DELETE action query to remove outdated records based on dynamic date calculations.
Observed behavior
The query executes but reports that 0 records will be deleted, leaving the intended records unchanged due to criteria mismatch.
Before you start

Make a copy of your database before modifying and running any action queries, ensuring you have a fallback if unintended records are targeted during testing.

Solution 1Recommended

Test Query Criteria Using a SELECT Statement

Convert the DELETE query into a SELECT query to safely view and adjust the date criteria without altering actual data.

When a DELETE query utilizes complex criteria, such as subqueries and dynamic dates like Year(Date()), incorrect logic will often result in zero records matching the condition. Converting the action to a SELECT query allows you to debug the criteria visually.

This approach is essential during the query development phase. Once you have verified the criteria is accurate, the query can be saved as a DELETE query and run routinely.

1
Open Query in Design View

Right-click the problematic DELETE query in the Navigation Pane and select 'Design View'.

2
Change to Select Query

On the Query Design ribbon, click the 'Select' button in the Query Type group to convert the action query to a standard view.

3
Adjust Date Criteria

Locate the criteria field using date math. For instance, if you are using '< Year(Date())-2', change the numeric value (e.g., to '-3') to adjust which historical years (like 2018 vs 2019) are included in the results.

4
Preview the Results

Click the 'Run' button (red exclamation mark) or switch to Datasheet View to see exactly which records are returned by your current logic.

5
Revert to Delete Query

Once the datasheet displays the correct records intended for deletion, return to Design View, click 'Delete' in the Query Type group, and execute the query.

Test Query Criteria Using a SELECT Statement
Safe Debugging: By testing with a SELECT query first, you completely eliminate the risk of accidentally deleting the wrong records while tweaking your subquery parameters.
Free Microsoft Office alternative

Looking for a Free Office Suite? Try WPS Office

While Microsoft Access is a specialized database tool, managing your everyday spreadsheets, documents, and presentations shouldn't be costly. WPS Office provides a free, lightweight, and highly compatible alternative for all your primary productivity needs.

  1. 1. Download WPS Office: Visit the official WPS Office website and click the free download button.
  2. 2. Install the Suite: Run the downloaded installer and follow the straightforward setup instructions.
  3. 3. Start Creating: Open WPS Office to instantly view, create, or edit your documents, spreadsheets, and presentations.
Seamlessly compatible with Microsoft Excel (.xlsx), Word (.docx), and PowerPoint (.pptx) formats.Lightweight design that runs smoothly on almost any device without draining system resources.Familiar tabbed user interface, allowing you to manage spreadsheets and documents in one window.Rich built-in PDF editing tools for free.
microsoft office alternative - wps office

Frequently Asked Questions

How does the Year(Date()) function work in Access queries?

The Date() function retrieves the current system date, and the Year() function extracts just the four-digit year from it. Using Year(Date())-2 dynamically calculates the year from two years ago, which is useful for filtering historical records without hardcoding dates.

Why would my Access query return zero records when the criteria seems correct?

This usually happens if date conditions contradict each other, if a subquery is returning NULL values, or if the calculation excludes the boundary year you meant to include (e.g., using < instead of <=).

Can an executed DELETE query be undone in MS Access?

No. Once a DELETE query executes and you click 'Yes' on the confirmation prompt, the records are permanently removed from the tables. This is why testing with a SELECT query and keeping regular backups is crucial.