S
Stockwell43
Hello,
I have several queries that with a click of a button transfers the data to
Excel and works fine. Here is the Code:
Private Sub cmdExportC_Click()
On Error GoTo Do_Nothing
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"qryprocstatus", txtExportFileC
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"qryregion", txtExportFileC
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"qrymonthenddetail", txtExportFileC
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"qrybankcenter", txtExportFileC
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"inventory", txtExportFileC
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"inventory_details", txtExportFileC
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"qryissues", txtExportFileC
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"qryerrorcode", txtExportFileC
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"qryissues", txtExportFileC
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"qryerrorcode", txtExportFileC
MsgBox "The tables have been successfully exported to " & txtExportFileC
& "."
Exit Sub
Do_Nothing:
MsgBox "Export has failed. An error occurred or the user terminated the
operation."
End Sub
However, when I click the button to run the query again and put in a
different date range, it adds it to the old instead of replacing it. How can
I get the new information to overide the old or on the click somehow delete
the old to capture the new?
I have several queries set up but may not use them all so I comment some
out. I am still in the designing phase.
Thanks Folks!!!!
I have several queries that with a click of a button transfers the data to
Excel and works fine. Here is the Code:
Private Sub cmdExportC_Click()
On Error GoTo Do_Nothing
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"qryprocstatus", txtExportFileC
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"qryregion", txtExportFileC
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"qrymonthenddetail", txtExportFileC
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"qrybankcenter", txtExportFileC
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"inventory", txtExportFileC
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"inventory_details", txtExportFileC
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"qryissues", txtExportFileC
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"qryerrorcode", txtExportFileC
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"qryissues", txtExportFileC
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"qryerrorcode", txtExportFileC
MsgBox "The tables have been successfully exported to " & txtExportFileC
& "."
Exit Sub
Do_Nothing:
MsgBox "Export has failed. An error occurred or the user terminated the
operation."
End Sub
However, when I click the button to run the query again and put in a
different date range, it adds it to the old instead of replacing it. How can
I get the new information to overide the old or on the click somehow delete
the old to capture the new?
I have several queries set up but may not use them all so I comment some
out. I am still in the designing phase.
Thanks Folks!!!!