Extracting text of queries (SQL) and Macros?

T

topmind

Does anybody know of a tool or technique to get a
"dump" (serialization) of Access's objects and configurations,
especially query SQL text and macro names and parameters? I inherited
a big-ball-of-mud for maintenance and would like to take inventory and
search on all the queries, macros, etc. It doesn't use a lot of VBA,
so that's not really the issue. Thanks. -t-
 
H

Hunter57 via AccessMonster.com

Hi,

Here is some code that will get the query names and SQL for you. You just
need to make a new Table with the ID, QueryDefName, and QueryDefSQL fields,
The QueryDefSQL field must be a *Memo* field to hold all the long SQL
statements. Change the UsystblQueryDefs Table name in the code to the name
you give your Table.

'-----------------------------------------------------------------------------
----------
' Procedure : GetQueryDefs
' DateTime : 9/30/2007 18:33
' Author : Patrick Wood
' Purpose : Copy all Database QueryDefs to the UsystblQueryDefs Table
'-----------------------------------------------------------------------------
----------
'
Sub GetQueryDefs()
Dim Dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset

Set Dbs = DBEngine(0)(0)
Set rst = Dbs.OpenRecordset("USystblQueryDefs", dbOpenDynaset)

For Each qdf In Dbs.QueryDefs
With rst
.AddNew
!QueryDefName = qdf.Name
!QueryDefSQL = qdf.sql
.Update
End With
Next qdf

rst.Close
Set rst = Nothing
Set qdf = Nothing
Set Dbs = Nothing
End Sub

Best Regards,
Patrick Wood
http://gainingaccess.net
Free Tutorial series on building a Date Dialog Form for Forms and Reports,
and using Outlook from Access.
Take a look at what Arvin Meyer has athttp://www.datastrat.com/Code/DocDatabase.txt

Thanks! Excellent, Kudos!

The queries are not quite in SQL form, but that's not a show-stopper
in this case.

-t-
[quoted text clipped - 6 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top