M
Mike
I have a form displaying external documents (non access) in different
folders.
Folders: Draft, Active, Archive.
I have buttons to move files from the draft to the active folder and
from the active to the archive folder. So far it works pretty fine,
but if someone would put a document in the draft folder which has
already the filename as in the active folder, the new draft file would
overwrite the existing active file. My code actually doesn't show if a
file already exists if one wants to move files from the form.
Here's the code:
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
!!! The IF part doesn't work !!! (but I think it shows what I want to
do)
If strNewName = strtargetfielpath & "\" & DLookup("[Name1]",
"documents_tbl") Then
MsgBox "file already exists" = vbCancel
Else
FileCopy strOldName, strNewName
Kill strOldName
End If
Thanks for any help
folders.
Folders: Draft, Active, Archive.
I have buttons to move files from the draft to the active folder and
from the active to the archive folder. So far it works pretty fine,
but if someone would put a document in the draft folder which has
already the filename as in the active folder, the new draft file would
overwrite the existing active file. My code actually doesn't show if a
file already exists if one wants to move files from the form.
Here's the code:
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
!!! The IF part doesn't work !!! (but I think it shows what I want to
do)
If strNewName = strtargetfielpath & "\" & DLookup("[Name1]",
"documents_tbl") Then
MsgBox "file already exists" = vbCancel
Else
FileCopy strOldName, strNewName
Kill strOldName
End If
Thanks for any help