Its very difficult when you have to debug queries linked with multiple queries in MS Access or if you want to find specific text in all queries in the same database
This code will create a text file in the name of database on the same database's folder and list out all SQL text from the database with the query name.
Dim db As Database
Dim q As QueryDef
Dim CurrentPath As String
CurrentPath = Application.CurrentProject.Path & "\"
Set db = CurrentDb
Open CurrentPath & "SQL_" & Replace(Application.CurrentProject.Name, ".mdb", "") & ".txt" For Append As #1
For Each q In Application.CodeDb.QueryDefs
Print #1, q.Name & ":" & vbNewLine & q.sql