BobC said:
I merely want to update the table to be used as an export to Excel
using TransferSpreadsheet. Each time it prompts for deleting old
records and adding new records. Is there a was to turn off the
prompts? Bottom line - I want to create an Macro to export the output of a
query to an Excel spreadsheet.
As Gina hinted, without really saying so, you won't be able to accomplish
directly this with a Macro. You will have to use VBA code, which can be
called by a Macro, but I'm not really sure why a macro would be needed. You
can call VBA code using a button on a form as simply as you can call a
macro.
Anyways, I do think some error-handling should be added to Gina's suggestion
so that if an error occurs, you won't be stuck with Warnings turned off
until the user turns them back on via Tools|Options or restarts Access.
Sub SpreadSheetXferNoWarnings()
On Error Resume Err_Handler
DoCmd.SetWarnings False 'Off
Your commands to update the table
and transfer the spreadsheed here
Exit_Sub:
DoCmd.SetWarnings True 'On
Exit Sub
Err_Handler:
Msgbox Err.Description
GoTo Exit_Sub
End Sub