Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / SQL Server / ADP / May 2008

Tip: Looking for answers? Try searching our database.

view multiple Queries' SQL statement

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SQL novice - 21 Feb 2008 16:54 GMT
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?
Sylvain Lafontaine - 21 Feb 2008 22:14 GMT
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?
yangxianfa - 12 May 2008 15:59 GMT
> 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 -

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.