newbee2
Technical User
- Apr 21, 2002
- 85
Hi,
I have managed to get three queries to export to an excel spreadsheet using the following code I set up in a module. I am working blind which is nothing new.
Function ExportToExcel()
'Run queries to create tables to use for export to an excel spread sheet
'The queries have parametric equations to select the required data for the time period.
'three queries have to be exported.
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "MarketInvoiceToDateBudgetSumQuery1", "C:\My documents\Copy of BUDGET04", hasfieldnames = True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "MarketSalesEnquiryInstantInvoiceSumQuery", "C:\My documents\Copy of BUDGET04", hasfieldnames = True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "MarketUnionConvertSumQuery", "C:\My documents\Copy of BUDGET04", hasfieldnames = True
DoCmd.close acform, "Choose Report"
End Function
1)Is it possible to get all three to go to one worksheet in the workbook if it is designated.
2) How do you designate a particular worksheet?. I have tried [Copy of BUDGET04]!SheetA , but it doesn't work.
3)And if so how do you get them to append to each other, one after the other without over writing?.
When they export thet create there own worksheets in the spreadsheet.
Thanking in advance anyone who can assist.
Kind Regards
Bill
I have managed to get three queries to export to an excel spreadsheet using the following code I set up in a module. I am working blind which is nothing new.
Function ExportToExcel()
'Run queries to create tables to use for export to an excel spread sheet
'The queries have parametric equations to select the required data for the time period.
'three queries have to be exported.
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "MarketInvoiceToDateBudgetSumQuery1", "C:\My documents\Copy of BUDGET04", hasfieldnames = True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "MarketSalesEnquiryInstantInvoiceSumQuery", "C:\My documents\Copy of BUDGET04", hasfieldnames = True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "MarketUnionConvertSumQuery", "C:\My documents\Copy of BUDGET04", hasfieldnames = True
DoCmd.close acform, "Choose Report"
End Function
1)Is it possible to get all three to go to one worksheet in the workbook if it is designated.
2) How do you designate a particular worksheet?. I have tried [Copy of BUDGET04]!SheetA , but it doesn't work.
3)And if so how do you get them to append to each other, one after the other without over writing?.
When they export thet create there own worksheets in the spreadsheet.
Thanking in advance anyone who can assist.
Kind Regards
Bill