Prevent overwriting existing Word Docs

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I wonder whether anyone can help me.
I'm using
DoCmd.SaveAs strDocumentPath & strDocumentName
to save a Word document that has been generated from my database
strDocumentName is based on the recipient name and the current date. At the
moment DoCmd.SaveAs is overwriting any existing files of the same name. How
do I invoke the normal Windows Save dialog box that warns the user that the
file already exists and allows them to change the name?

Failing that I suppose I need a way to notify the user that an existing file
is about to be overwritten.
Any help would be greatly appreciated.
Anna
 
Hi,
You can see if the code here is any help to you:
http://www.mvps.org/access/api/api0001.htm

or you can use the Dir function to see if the file exists.
Dir will return an empty string if the file does not exist so...

If Dir(strDocumentPath & strDocumentName) <> "" Then
'file exists
End If
 
Back
Top