Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export Query Text

Status
Not open for further replies.

tjb2

Programmer
Jul 24, 2003
17
US
I have an access 97 application I need to deconstruct in order to rewrite as a .NET application. There are MANY queries in the database. Is there a way to print/export the code for all of the queries in the db with out "sql view - copy - paste"?

Thanks For Any And All Help

SimpleMusings!
 
create a folder c:\query
past this sub in a moudel and run
Code:
Sub SaveQueryiesAsText()
Dim mydb As Database
Dim qerdefs As QueryDefs
Dim qerdef As QueryDef
Set mydb = CurrentDb
Set qerdefs = mydb.QueryDefs

For Each qerdef In qerdefs
    
    Open "c:\Query\" & qerdef.Name & ".txt" For Output As 1
    Print #1, qerdef.SQL
    Close #1
    'SaveAsText acQuery, qerdef.Name, "c:\Query\" & qerdef.Name & ".txt"
Next


End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top