Suppress "Do you want to replace the Existing File" in an AutoExec macro

I've written an AutoExec macro that works fine, running a series of queries.  However, when it comes to an Output command to an existing report that I want to replace, the prompt "The file already exists.  Do you want to replace the existing file" stops the macro from continuing until I answer the question Yes.  I've searched ExpertsExchange for a similar question, and tried creating a Global Function which I include as one of my first macro steps.  The function is ActionQueryConfirmation(False).  This doesn't work, I'm still prompted "Do you want to replace the existing file Yes/No".  I'm wanting to run this macro every morning, creating 3 new reports for the users to have available first thing.  
Public Function ActionQueryConfirmation(NewValue As Boolean)
    Application.SetOption "Confirm Action Queries", NewValue
End Function

Open in new window

KarenPRuskinAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jorge PaulinoIT Pro/DeveloperCommented:
Hi KarenPRuskin,

Have you tried SetWarnings = No in the macro ?

jpaulino
0
KarenPRuskinAuthor Commented:
Yes, I do this at the beginning of the macro.  
0
ldunscombeCommented:
You could try deleting the file before you recreate it in your function as follows

Public Function ActionQueryConfirmation(NewValue As Boolean)

Dim delfile as string
delfile = "C:\<Your Directory>\<Your File> 'Set delfile as the "Full Path to the file you want to delete including the file extension.
Kill (delfile) ' Delete the file

    Application.SetOption "Confirm Action Queries", NewValue
End Function

Leigh
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KarenPRuskinAuthor Commented:
Worked absolutely perfectly Leigh.  Thank you so much, I appreciate your prompt response ... not to mention your expertise!  Cheers, Karen
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.