Results 1 to 5 of 5
  1. #1
    mr steev is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Feb 2015
    Location
    UAE-Ajman
    Posts
    10

    permission denied when you move a folder from the local disk: \ D to: \ C

    I have this code that moves a folder from the current path to the local disk: \ C The problem I have when the current path of the database is in a disk other than the: \ C Gives a permission denied message This is the code:

    <Private Sub Form_Load()
    On Error GoTo MyErr
    Dim FSO As Object
    Dim FromPath As String
    Dim ToPath As String

    FromPath = CurrentProject.Path & "\MyFolder"
    ToPath = "C:\MyFolder"

    If Right(FromPath, 1) = "\" Then
    FromPath = Left(FromPath, Len(FromPath) - 1)
    End If


    If Right(ToPath, 1) = "\" Then
    ToPath = Left(ToPath, Len(ToPath) - 1)
    End If

    Set FSO = CreateObject("scripting.filesystemobject")
    If FSO.FolderExists(FromPath) = False Then
    Exit Sub
    End If
    If FSO.FolderExists(ToPath) = True Then
    Exit Sub
    End If
    FSO.MoveFolder Source:=FromPath, Destination:=ToPath

    MyErr: If Err.Number <> 0 Then
    MsgBox Err.Number & " - " & Err.Description
    End If
    End Sub

    So what is the solution ???
    Last edited by mr steev; 08-11-2019 at 07:34 PM.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Please post code between CODE tags to retain indentation and readability.

    However, I tested code on my personal laptop and it works.

    Are you running this on a computer in a network? Ask your IT people. My IT people set protections that prevent programmatic copying of files/folders. I know because it used to work then with new computers it doesn't.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    mr steev is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Feb 2015
    Location
    UAE-Ajman
    Posts
    10
    I have local computer windows 10 and windows installed on the local disk C:\

    When I put my database with myfolder on local disk D:\ and i run my database on main form Gives that message:
    70-permission denied

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Ooops, in my first test, forgot to use drive D:\. Yes, I get that message. As far as I can tell, it is Windows 10 security. Workaround should be to copy then delete. Review
    https://www.devhut.net/2010/11/15/ms...move-a-folder/
    Have not tested. Might still be issues because I used to have code that copied (not moved) on computers in network system and lost that capability on newer computers.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    mr steev is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Feb 2015
    Location
    UAE-Ajman
    Posts
    10
    Ok ... Thank you so much

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Permission Denied Run Time Error 70
    By nick243 in forum Security
    Replies: 0
    Last Post: 03-14-2019, 12:13 PM
  2. Replies: 15
    Last Post: 02-02-2019, 07:29 PM
  3. Replies: 3
    Last Post: 01-21-2017, 04:09 AM
  4. Getting Permission Denied error when moving file
    By ricksil in forum Programming
    Replies: 2
    Last Post: 01-20-2016, 11:21 AM
  5. Replies: 3
    Last Post: 09-01-2010, 08:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums