Gary-
You could export all the query SQL as a text file like this:
Dim db As DAO.Database, qdf As DAO.QueryDef
Dim intI As Integer, strObjName As String
Set db = CurrentDb
' Open an output file
Open CurrentProject.Path & "\AccessSQL.txt" For Output Access Write As #1
' Loop to process them all
For intI = 0 To db.QueryDefs.Count - 1
' Point to the query
Set qdf = db.QueryDefs(intI)
' Save the name for debug
strObjName = qdf.Name
' Skip temp system queries
If Left(qdf.Name, 1) <> "~" Then
' Output the query name
Print #1, strObjName
' Output the SQL
Print #1, qdf.SQL
' Add a space
Print #1, " "
End If
' Do the next one
Next intI
Set qdf = Nothing
Close #1
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
On Apr 24, 2015, at 7:54 PM, 'Gary D. Schwartz' gary.schwartz@pobox.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Hi:
I have an older db in Access 2003 with about 3000 queries.
I am looking for a method to extract the Access SQL code from all of
the queries. I know how to do this one at a time, but . . .
Complicating this is that some utilities will truncate to fit 255
characters, which is a problem for some queries. Outppuit to tex CSV
or to html would be preferable.
Thanks,
Gary
--------------------------------------------------------
Gary D. Schwartz Please reply to: gary.schwartz@pobox.com
--------------------------------------------------------
Gary D. Schwartz Please reply to: gary.schwartz@pobox.com
------------------------------------
Posted by: "Gary D. Schwartz" <gary.schwartz@pobox.com>
------------------------------------
------------------------------------
Yahoo Groups Links
Posted by: John Viescas <johnv@msn.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
Tidak ada komentar:
Posting Komentar