The code below exports the query name and the the first line only of the SQL code.
Is there a way to export the FULL SQL code to a table, or text file?
Is there a way to export the FULL SQL code to a table, or text file?
Code:
Sub ExportQueries()
Dim db As Object
Dim qdf As Object
Dim rs As Recordset
On Error Resume Next
Set db = CurrentDb
Set rs = oDB.OpenRecordset("Query_Temp", dbOpenDynaset)
For Each qdf In db.QueryDefs
If InStr(qdf.Name, "~") = 0 Then
rs.AddNew
rs!query_name = qdf.Name
rs!query_text = qdf.SQL
rs.Update
End If
Next qdf
End Sub