Export multiple Queries to same Workbook Cant overwrite Content (1 Viewer)

Wapug

Registered User.
Local time
Today, 12:05
Joined
Apr 14, 2017
Messages
51
I have an access db where I have written code to export the results of three queries to an excel workbook. The workbook will contain, or may contain data from previous exports and I would like to have the new data from my db overwrite the existing data in the workbook.
I have used the TransferSpreadsheet method to export the three queries. How can I add code that will delete any existing data on the three tabs in the target workbook?
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "qBacon", strpath
 

Ranman256

Well-known member
Local time
Today, 12:05
Joined
Apr 9, 2015
Messages
4,337
The export does not erase the previous data.
Can you just erase the workbook, then export?
 

Mark_

Longboard on the internet
Local time
Today, 09:05
Joined
Sep 12, 2017
Messages
2,111
MMmmmmmm......qBacon......
 

Wapug

Registered User.
Local time
Today, 12:05
Joined
Apr 14, 2017
Messages
51
The export does not erase the previous data.
Can you just erase the workbook, then export?

I don't want to delete the entire workbook because it contains multiple other sheets with information that is needed.
 

Users who are viewing this thread

Top Bottom