export access query to excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello!

I wish to export a query to excel via "TransferSpreadsheet":

DoCmd.TransferSpreadsheet acExport, 8, "Queryname", "H:
\Office2000\Access\Test2.xls", True, "

With this code I could only export tables, not queries. The error message
says it can't find any objects with the name "Queryname". Can anyone tell me
how to modify the code in order to search for queries?

Thanks!!
 
Hello!

I wish to export a query to excel via "TransferSpreadsheet":

DoCmd.TransferSpreadsheet acExport, 8, "Queryname", "H:
\Office2000\Access\Test2.xls", True, "

With this code I could only export tables, not queries. The error message
says it can't find any objects with the name "Queryname". Can anyone tell me
how to modify the code in order to search for queries?

Thanks!!

This works for me.

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"qryExportYear", "C:\My Household\YearlyGraphs.xls",True

You did change "Queryname" to the actual name of your query didn't
you? Are you sure you have the name of the query spelled correctly?

You also have an extra quote symbol stuck at the end of your code.
If there is no argument after True, leave it blank and omit the final
comma.
 
Back
Top