We help IT Professionals succeed at work.
Get Started

MS Access - Error - You don't have permission to modify files in the network location

WS asked
Last Modified: 2017-12-10

I have a form that have two text boxes as Source and Target. The Source take the source path and the destination textbox copy the file to the destination path.An error pop up at the time of coping file which is run time error says "You don't have permission to modify files in the network location contact Administrator", i am the administrator of the server and the write permission is set to yes. When i manually copy the file it's working but when i try to copy using this VBA code it's giving this error. Although considering the file gets copied but still it's giving up this error, anyone have any idea about that?

As you can see in the image the file is copied as i have write permission. Also when i manually tried to copy its working without any error.Why is this error coming? Due to VBA or due to something else or VBA is not copying instead modifying?

Attach is VBA code if require to  look at :

Private Sub txtSource_Click()
 Dim Dialog      As FileDialog
    Dim Selected    As Long
    Set Dialog = FileDialog(msoFileDialogFilePicker)
   With Dialog
    .AllowMultiSelect = False
    .InitialFileName = Nz(Me!txtSource.Value)
        .Title = "Select file to copy"
        Selected = .Show
        If Selected <> 0 Then
            Me!txtSource.Value = .SelectedItems.Item(1)
        End If
    End With
    Cancel = True
End Sub

Private Sub txtTarget_Click()
Dim Dialog As FileDialog
    Dim Selected    As Long
    Set Dialog = FileDialog(msoFileDialogSaveAs)
    With Dialog
    .AllowMultiSelect = False
    .InitialFileName = Nz(Me!txtSource.Value)
        .Title = "Name saved file"
         '.InitialFileName = "N:\"
        Selected = .Show
        DoCmd.SetWarnings False
        If Selected <> 0 Then
         Me!txtTarget.Value = .SelectedItems.Item(1)
         TargetFile = .SelectedItems.Item(1)
            If Not IsNull(Me!txtSource.Value) Then
                 FileCopy Me!txtSource.Value, Me!txtTarget.Value
                 Me.txtTarget = Split(TargetFile, ":")(1)
            End If
           ' Application.FollowHyperlink Me.txtTarget
        End If
    End With
    Cancel = True
End Sub

Open in new window

Watch Question
Most Valuable Expert 2015
Distinguished Expert 2018
This problem has been solved!
Unlock 2 Answers and 21 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE