In MS Access I need to back up all queries to a text file
Im able to do this with other Access objects fine, for example the following is a sample that backs up all reports to a text file
Dim oApplication
Set oApplication = CreateObject("Access.Application")
For Each myObj In oApplication.CurrentProject.AllReports
WScript.Echo "Report " & myObj.fullname
oApplication.SaveAsText acReport, myObj.fullname, sExportpath & "\" & myObj.fullname & ".report"
Next
Ive tried the following to backup all queries
For Each myObj In oApplication.CurrentData.AllQueries
WScript.Echo "Query " & myObj.fullname
oApplication.SaveAsText acQuery, myObj.Name, sExportpath & "\" & myObj.Name & ".query"
Next
However the resulting text file is the query output. Its definitely not the Query Definition that Im looking for.
To be clear here is an image of what Im trying to export to text
Does anyone have any ideas on how that can be accomplished?
SaveAsText acQuery
gives me the query definition ... which includes the SQL property and sundry other attributes Access stores in the definition. ButSaveAsText
definitely does not give me the data which running the query returns. Seems an odd "feature" to add to 2013. :-( – MaudemaudieacQuery
is 1. See AcObjectType Enumeration. None of those constants has 6 as its value. – MaudemaudieacQuery
there. Then looked up the enumeration's name to find you that web link. – Maudemaudie