I need to review the SQL statements of queries in Microsoft Access. I am
opening each one individually. Time consuming and tedious. Is there a way I
can download these queries and only their SQL statement to one table, excel
or word doc?
Here's a way to collect the text information for all queries into a text
file (this must be executed from a MDB file):
Public Sub WriteQueries()
Dim intFile As Integer
Dim db As DAO.Database
Dim qdfs As DAO.QueryDefs
Dim qdf As DAO.QueryDef
intFile = FreeFile
Open CurrentProject.Path & "\queries.text" For Output As intFile
Set db = CurrentDb
Set qdfs = db.QueryDefs
For Each qdf In qdfs
Print #intFile, qdf.Name
Print #intFile, qdf.SQL
Next qdf
Close intFile
End Sub

Signature
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)
>I need to review the SQL statements of queries in Microsoft Access. I am
> opening each one individually. Time consuming and tedious. Is there a way
> I
> can download these queries and only their SQL statement to one table,
> excel
> or word doc?
> I need to review the SQL statements of queries in Microsoft Access. I am
> opening each one individually. Time consuming and tedious. Is there a way
> I
> can download these queries and only their SQL statement to one table,
> excel
> or word doc?
a a r o n . k e m p f @ g m a i l . c o m - 13 May 2008 11:36 GMT
if you're doing this in SQL Server, then you can just look in the
syscomments table.
-aaron
> > I need to review the SQL statements of queries in Microsoft Access. I am
> > opening each one individually. Time consuming and tedious. Is there a way
[quoted text clipped - 4 lines]
>
> - Show quoted text -