MS Access - stopping it asking whether ok to overwrite

HI there,

Hopefully an easy one!

I have set up a macro to send 2 reports using outputto to a file as html docs.

I want these to be sent when the form closes so have attached the macro to the close button.

However it keeps asking whether it is ok to overwrite the files as they already exist.

Can I disable this so it automatically saves over them ?

Thanks

Dave
plusoneAsked:
Who is Participating?
 
Steve KnightConnect With a Mentor IT ConsultancyCommented:
Have you done this in VBA?

How about adding something like this to delete the file if it exists first?

filename$="c:\myfilename.html"
if dir$(filename$)<>"" then KILL filename$

Steve
0
 
MoliereCommented:
You can use the brute force method of wrapping:

docmd.setwarnings false
.
.
.
docmd.setwarnings true

around the code that outputs to html.h
0
 
KodeBunnyCommented:
The SetWarnings action will not work with overwriting a file.  

In your macro, instead of using the OutputTo action, perhaps you could try the TransferText action.  The TransferText will give you similar results.  

Set the Action to TransferText instead of OutputTo.  Set  Transfer Type argument to Export HTML; the rest of the arguments as needed.
0
 
crimperCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by Dragon-it

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

John Pullin
EE Cleanup Volunteer
0
All Courses

From novice to tech pro — start learning today.