Hi Jim,
What does your OutputTo code look like? I use it all the time for automated processes to send a file out daily, and it always overwrites the previous file as desired. Here's an example:
DoCmd.OutputTo acOutputQuery, "qryGetDriverInfo", acFormatXLS, "C:\AccessAp\DriversOver11.xls"
I suppose if it wasn't working for you the Kill command could first be used to delete the previous file, but in my experience that isn't needed.
Paul
------ Original Message ------
From: "Jim Wagner" <josephwagner2@outlook.com>
Sent: 5/31/2023 8:56:25 AM
Subject: [MSAccessProfessionals] VBA Export to excel issue
Hello all,
I am trying to export a query to excel. I have successfully exported to excel but each time I run the code, a new tab in the spreadsheet is added. I have tried many instances of docmd.transferspreadsheet and
dcmd.OutputTo and
Killpath code.
But neither have fixed the problem. I have done this before and never had this issue. Is there a different way?
Thank You so much for your help.
Jim Wagner