M
Mike
I have the following code that moves files between folders.
Unfortunately, already existing files get overwritten if the new
filename is the same. Is there a way to prompt the user in case the
file would already exist and to abort the copy kill operation?
here's my code:
Private Sub Command9_Click()
Dim strNewName As String
Dim strOldName As String
Dim strtargetfilepath As String
strtargetfilepath = DLookup("[Draft to Active]", "filepath")
strOldName = Me.Filename
strNewName = strtargetfilepath & "\" & Me.Name1
FileCopy strOldName, strNewName
Kill strOldName
End Sub
The new name of the file is created by using the targetfilepath and
adding the filename (without the old filepath). But it could be that
this filepath already exists.
Thanks for any help.
Unfortunately, already existing files get overwritten if the new
filename is the same. Is there a way to prompt the user in case the
file would already exist and to abort the copy kill operation?
here's my code:
Private Sub Command9_Click()
Dim strNewName As String
Dim strOldName As String
Dim strtargetfilepath As String
strtargetfilepath = DLookup("[Draft to Active]", "filepath")
strOldName = Me.Filename
strNewName = strtargetfilepath & "\" & Me.Name1
FileCopy strOldName, strNewName
Kill strOldName
End Sub
The new name of the file is created by using the targetfilepath and
adding the filename (without the old filepath). But it could be that
this filepath already exists.
Thanks for any help.