List all the queries in your database
The following function prints to the immdiate window all the queries in your database, including SQL strings defined as form recordsources and as control rowsources.
Function QueriesList() As Boolean
On Error GoTo QueriesListErrorHandler
Dim db As Database
Dim qdf As QueryDef
Set db = CurrentDb
For Each qdf In db.QueryDefs
Debug.Print ""
Debug.Print "Name: " & qdf.Name
Debug.Print "Description: " & qdf.Properties("Description")
Debug.Print "Date Created: " & qdf.DateCreated
Debug.Print "Date Modified: " & qdf.LastUpdated
Debug.Print "SQL: "
Debug.Print qdf.SQL
Debug.Print "___________________________________________________________________________"
Next qdf
QueriesList = True
Exit Function
QueriesListErrorHandler:
If Err = 3270 Then 'Description property not found ie. there is no description for this query
Debug.Print "Description: na"
Resume Next
Else
QueriesList = False
MsgBox "Query Definition Error " & Err & ". " & Err.Description, , aad_THIS_APP
Exit Function
End If
End Function