M
Mark
I'm trying to export multiple queries to one Excel workbook
using VBA. I have a table containing the names of all the
queries I want to export, and I loop through the records in
the table and export them one at a time. The problem is
that every query exported overwrites the existing workbook
and/or worksheet, so in the end I only have the results of
one query in Excel, instead of a separate tab for each
query. My code looks like this:
For iQuery = 1 To 2 'rcdsQueries.RecordCount
sQuery = rcdsQueries.Fields("QueryName")
DoCmd.OutputTo acOutputQuery, sQuery,
"MicrosoftExcel(*.xls)", sXLSFileName, False, ""
rcdsQueries.MoveNext
Next iQuery
How can I get the results of each query to show up in a
separate tab. Thanks in advance.
Mark
using VBA. I have a table containing the names of all the
queries I want to export, and I loop through the records in
the table and export them one at a time. The problem is
that every query exported overwrites the existing workbook
and/or worksheet, so in the end I only have the results of
one query in Excel, instead of a separate tab for each
query. My code looks like this:
For iQuery = 1 To 2 'rcdsQueries.RecordCount
sQuery = rcdsQueries.Fields("QueryName")
DoCmd.OutputTo acOutputQuery, sQuery,
"MicrosoftExcel(*.xls)", sXLSFileName, False, ""
rcdsQueries.MoveNext
Next iQuery
How can I get the results of each query to show up in a
separate tab. Thanks in advance.
Mark