How to Find Access 2010 Queries That Use a Table
Question details
Identify saved Access queries that reference a particular table in a large database.

- 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.
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.
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.
In Access, press Alt+F11, then choose Insert > Module.
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
Click inside the procedure and press F5. Press Ctrl+G to open the Immediate window and review the query names and SQL statements.
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.

Review Query SQL with Database Documenter
Use the built-in Documenter to produce a report of query definitions for searching and review.
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.

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.




