Link to home
Start Free TrialLog in
Avatar of ES-Components
ES-ComponentsFlag for United States of America

asked on

Can I Stop Access 2007 from asking "Do You Want To Replace The Existing File?

I am using Access 2007 and have what I believe is a simple Macro. I basically want to output a Report to a folder on my PC. Each time I run the Macro it asks me "Do I want to replace the existing file? (I do not want to see this prompt)
I attached a jpeg of the Macro Action Arguments that I used alng with the prompt.

Is there a simple way to eliminate the prompt as I want to run this Macro as an
"AutoExec" macro?

If there is special coding to be done, please explain where as I am not an Access Expert.

Any help would be greatly appreciated.
Rick
AccessMacroError.jpg
ASKER CERTIFIED SOLUTION
Avatar of Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
change the action OutputTo in your macro with

RunCode




Function Name ExportReport()


then create this function in a regular module

Function exportReport()
Dim fPath As String, fName As String
fPath = "\\Server\escfiles\Intranet\ControlPanel\Word\"
fName = "ARCollections-All.rtf"

If Dir(fPath & fName) <> "" Then Kill fPath & fName
DoCmd.OutputTo acOutputReport, "ARCollections-All", acFormatRTF, fPath & fName, no, , , acExportQualityPrint
End Function



.
I forgot to add that you would add the following before the Output line:

Action: RunCode
KillProperly("\\Server\escfiles\Intranet\ControlPanel\Word\ARCollections-All.rtf")
Avatar of ES-Components

ASKER

capricorn1
I think I got it to work. But there is another error.
Any ideas as to how to get this fixed?
See attached jpeg's for macro and error message

Thank you...
Rick
AccessMacro2.jpg
AccessMacro2Error.jpg
read the messages from the error window,
check if any of those applies to your case, it is pretty straightforward