How to Fix an Access Delete Query That Deletes Zero Records
Question details
The user needs to resolve an issue where an Access DELETE query fails to remove any records when utilizing date-based subqueries.

- 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.
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.
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.
Right-click the problematic DELETE query in the Navigation Pane and select 'Design View'.
On the Query Design ribbon, click the 'Select' button in the Query Type group to convert the action query to a standard view.
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.
Click the 'Run' button (red exclamation mark) or switch to Datasheet View to see exactly which records are returned by your current logic.
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.

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. Download WPS Office: Visit the official WPS Office website and click the free download button.
- 2. Install the Suite: Run the downloaded installer and follow the straightforward setup instructions.
- 3. Start Creating: Open WPS Office to instantly view, create, or edit your documents, spreadsheets, and presentations.

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.




