Move folder using Access Vba to a connected drive throws error 70

66 Views Asked by At

I want to use Microsoft Access Vba to move folders to a map network drive from my computer, however it is giving me continuously error 70 "Access denied". I am able to create folders on the network drive using MkDir, just not moving an existing folder from my PC to it.

The code works for moving folders on the PC to a different folder on the PC, just not to the network drive (of which I have full access). I can manually copy/move delete anything on the drive.

My real application will move all subfolders within a folder, but for simplicity sake I have tested it with an empty folder named Testfolder, which shows the same issue.

Private Sub Test_Click()
Dim FSO As New FileSystemObject
Set FSO = CreateObject("Scripting.FileSystemObject")

Dim Origin As String
Dim Destination As String

Origin = "C:\Testfolder"   'the name of the folder
Destination = "Y:\text\"   'path of destination ending with \

FSO.MoveFolder Origin, Destination
End Sub

What am I missing here?

I've tried the following already.

  1. Launched Access with administrator rights (no success)
  2. Reset all administrator rights for the Synology NAS (no success)
  3. Disconnect drive from PC and reconnect them (no success)
  4. Rewrote the destination part of the code using UNC ""\\text\" (no success)

Edit:

  1. Tried a shell solution with xcopy from here (no success)
  2. The causes for a seemingly related issue don't seem applicable. My folder is empty, ends with \, and manual moving is possible
0

There are 0 best solutions below