Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB in Access , Need code to confirm overwrite message box.... 1

Status
Not open for further replies.

Moostang

ISP
Joined
Jan 11, 2003
Messages
5
Location
US
I am exporting a form to an htm file but it keeps prompting me "Do you want to replace the existing file?" . I need to automate this by auto selecting yes.

Public Sub Export()
DoCmd.OutputTo acOutputForm, "Node Summery: Today Subform (By Time)", acFormatHTML, "c:\aftp\quicksum.htm", False, "c:\template.htm"

Above is the code I used to export. Like I said, I need to automate this but cannot seem to figure out how to disable the replace prompt or auto select yes on it.

Any help would be appreciated.

 
Try these modifications:

Public Sub Export()
DoCmd.SetWarnings False
Kill "c:\aftp\quicksum.htm"
DoCmd.OutputTo acOutputForm, "Node Summery: Today Subform (By Time)", acFormatHTML, "c:\aftp\quicksum.htm", False, "c:\template.htm"
DoCmd.SetWarnings True
End Sub
The Kill statement deletes the file before you try to export the same file out to the path. This should get rid of the problem with ACCESS asking if you want to overwrite. I included the SetWarnings commands to take care of any other extraneous prompts that may pop up.

Let me know if this works for you.
Bob Scriver
 
Awsome, that works great!

Thanks for the help and quick reply!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top