Skip to content

Instantly share code, notes, and snippets.

@bryaneaton
Created November 10, 2021 19:28
Show Gist options
  • Save bryaneaton/33a9d8eda62fefe94627c44f36a5d029 to your computer and use it in GitHub Desktop.
Save bryaneaton/33a9d8eda62fefe94627c44f36a5d029 to your computer and use it in GitHub Desktop.
Dump Access Queries to Text file
Public Sub ListQueries()
' Modified from André Bernardes
Dim i As Integer
Dim ff As Long
ff = FreeFile()
Open "C:\temp\Queries.txt" For Output As #ff
On Error Resume Next
For i = 0 To CurrentDb.QueryDefs.Count - 1
Debug.Print "|" & CurrentDb.QueryDefs(i).Name & ":"
Print #ff, "|" & CurrentDb.QueryDefs(i).Name & ":"
Debug.Print CurrentDb.QueryDefs(i).SQL
Print #ff, CurrentDb.QueryDefs(i).SQL
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment