I have a client document library created that holds an entry for each document created within the system relative to a client. I save the created documents outside of the database on another network drive.
I also have the option to Add any other file to the Clients Document Library and consequently save the external document to the same network drive as all other documents created.
I am using the following code to move the external file into the network drive. It all works well.
BUT my problem is it actually moves the source file to the network drive INSTEAD of copying it
I have tried to find out what the Name strOldFile As strNewFile line in the code does but I've had no success. I have taken it out and nothing is moved or copied.
I would much appreciate any ideas please
I also have the option to Add any other file to the Clients Document Library and consequently save the external document to the same network drive as all other documents created.
I am using the following code to move the external file into the network drive. It all works well.
BUT my problem is it actually moves the source file to the network drive INSTEAD of copying it
Code:
Private Sub AddFileButt_Click()
Dim f As Object
Dim strFile As String
Dim strFolder As String
Dim varItem As Variant
Set f = Application.FileDialog(3)
f.AllowMultiSelect = True
If f.Show Then
Dim strDestDir, strOldFile, strNewFile
strDestDir = "\\TREND-SERVER\INVESTREND DATA\COMPANIES\Options Group\TOGAS\ClientMergeFiles\"
For Each varItem In f.SelectedItems
strFile = Dir(varItem)
strFolder = Left(varItem, Len(varItem) - Len(strFile))
strOldFile = strFolder & strFile
strNewFile = strDestDir & strFile
Name strOldFile As strNewFile
'MsgBox "File: " & strOldFile & " Has been uploaded"
Me.strFileNameFld = strFile
'MsgBox "File name= " & Me.strFileNameFld & " Matter Id = " & Me.MatterIdFld & " Matter No " & Me.MatterNoFld2
DoCmd.SetWarnings False
DoCmd.OpenQuery "AddExtFileToMatterDocLibQry" ' write the Document Library db entry
DoCmd.SetWarnings True
Forms!DocumentLibraryFrm.Requery
Next
End If
Set f = Nothing
End Sub
I have tried to find out what the Name strOldFile As strNewFile line in the code does but I've had no success. I have taken it out and nothing is moved or copied.
I would much appreciate any ideas please