Others

How to Find Access 2010 Queries That Use a Table

Rana GarciaRana Garcia Nov 25, 2026 868 views

Question details

Identify saved Access queries that reference a particular table in a large database.

How to Find Access 2010 Queries That Use a Table
Product
Microsoft Access 2010
Device & OS
not provided
Scenario
A user wants to find queries that use or create a specific table.
Observed behavior
The user needs a list of relevant queries and their SQL statements for review.
Before you start

Open the database in Access 2010 and note the exact table name as it appears in the Navigation Pane. Decide whether you need direct SQL references only or also want to trace dependencies through other queries.

Solution 1Recommended

Search Saved Query SQL with VBA

Use this method to list saved queries whose SQL text contains the table name.

This is a text search, so review each match: a table name can also occur in a comment, string, or another object name. Queries that reference the table indirectly through another query may not contain its name.

1
Open the VBA editor

In Access, press Alt+F11, then choose Insert > Module.

2
Add the search procedure

Paste this code into the module, replacing YourTableName with the table name: Public Sub FindTableQueries() Dim q As DAO.QueryDef Dim tableName As String tableName = "YourTableName" For Each q In CurrentDb.QueryDefs If InStr(1, q.SQL, tableName, vbTextCompare) > 0 Then Debug.Print q.Name Debug.Print q.SQL Debug.Print String(40, "-") End If Next q End Sub

3
Run the search

Click inside the procedure and press F5. Press Ctrl+G to open the Immediate window and review the query names and SQL statements.

4
Check each result

In the Access Navigation Pane, open matching queries in SQL View. Check clauses such as FROM, JOIN, and INTO to determine how each query uses or creates the table.

Search Saved Query SQL with VBA
Scope of the search: The procedure searches saved QueryDef SQL in the current database. It does not search VBA code, macros, form or report record sources, or external databases.
Free Microsoft Office alternative

Document Your Access Query Review in WPS Office

WPS Office is a free, lightweight alternative for creating and reviewing office documents, with a familiar interface and support for common Microsoft Office formats. Move your query review notes into a document or spreadsheet; WPS Office does not inspect Access databases or replace Access query tools.

Record query names and table references in a searchable spreadsheetOpen and save common Microsoft Office formats, including DOCX and XLSXUse a familiar interface for an easier transition from Microsoft OfficeWork with documents and spreadsheets in a lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Can I find the query that created a table?

Search saved query SQL for the table name, then inspect matching queries in SQL View for a SELECT ... INTO statement. The creating query may not be present if it was deleted or run from code.

Why does a search return queries that do not use my table?

A text search can match the table name inside another object name, a string, or a comment. Open each result in SQL View and check the SQL clauses to confirm the reference.

Will searching QueryDef SQL find indirect dependencies?

Not necessarily. If a query uses another query rather than naming the table, its SQL may not contain the table name. Inspect the queries referenced by your initial matches to trace the dependency chain.

Can WPS Office search queries inside an Access database?

No. Use Access Database Documenter or VBA to inspect saved Access queries. You can use WPS Spreadsheets or Writer to organize the results afterward.