Prev: dirDataCopy error message when converting to Access 2000
Next: Sorry...cannot find the DynaPDF.dll file
From: deko on 10 Jan 2006 08:47 Why am I getting: "Error Number 70: Permission denied" when trying to move a folder with the Microsoft Scripting Runtime? Is there some security setting I don't know about? Platform: Windows XP SP2 / Access 2003 Private Sub MoveFolder(strDestination As String) 'required references: 'Microsoft Office 11.0 Object Library 'Microsoft Scripting Runtime Dim dlg As Office.FileDialog Dim fso As Scripting.FileSystemObject Dim varFldr As Variant Set fso = New FileSystemObject Set dlg = FileDialog(msoFileDialogFolderPicker) 'open folder picker dialog dlg.AllowMultiSelect = False If dlg.Show = True Then For Each varFldr In dlg.SelectedItems strSource = varFldr Next Debug.Print strSource & " => " & strDestination 'the paths look fine... 'move folder and its contents If Len(strDestination) Then fso.MoveFolder strSource, strDestination 'ERROR HERE End If End If Set fso = Nothing Set dlg = Nothing End Sub Is there a problem with this code or is it an OS issue? Thanks in advance.
From: Steve on 10 Jan 2006 10:04 Is there a possibility the account this database is running under does not have write/modify permissions to either the source or destination folders (or one level above)? It is my understanding that the MoveFolder operation mimics a cut 'n' paste operation, which first copies the object to the destination folder and then deletes it from the source folder. The account needs to have permissions to delete the source folder and modify the folder containing it, and permissions to modify/write to the folder containing the destination folder.
From: deko on 10 Jan 2006 17:58
"Steve" <theonesteve(a)gmail.com> wrote in message news:1136905452.981072.285780(a)g47g2000cwa.googlegroups.com... > Is there a possibility the account this database is running under does > not have write/modify permissions to either the source or destination > folders (or one level above)? It is my understanding that the > MoveFolder operation mimics a cut 'n' paste operation, which first > copies the object to the destination folder and then deletes it from > the source folder. The account needs to have permissions to delete the > source folder and modify the folder containing it, and permissions to > modify/write to the folder containing the destination folder. But I can move files. Cut and paste these two functions into a standard module and test from the immediate window with something like: ?MoveTheseFilesTo("C:\NewFolder1\") (select any file from the dialog - NewFolder1 must exist) and ?MoveThisFolderTo("C:\NewFolder2\") (select any folder from the dialog - NewFolder2 must exist) You'll get the same results - files get moved no problem, but folders get hung up on "Error Number 70: Permission denied" Public Function MoveTheseDocumentsTo(strDestination As String) 'required references: 'Microsoft Office 11.0 Object Library 'Microsoft Scripting Runtime Dim varFile as Variant Dim dlg As Office.FileDialog Dim fso As Scripting.FileSystemObject Set fso = New Scripting.FileSystemObject Set dlg = FileDialog(msoFileDialogFilePicker) strDestination = strDestination & varFile If dlg.Show = True Then For Each varFile In dlg.SelectedItems fso.MoveFile varFile, strDestination Next End If Set dlg = Nothing Set fso = Nothing End Function Public Function MoveThisFolderTo(strDestination As String) 'required references: 'Microsoft Office 11.0 Object Library 'Microsoft Scripting Runtime Dim strSource as String Dim dlg As Office.FileDialog Dim fso As Scripting.FileSystemObject Dim varFldr As Variant Set fso = New FileSystemObject Set dlg = FileDialog(msoFileDialogFolderPicker) 'open folder picker dialog dlg.AllowMultiSelect = False If dlg.Show = True Then For Each varFldr In dlg.SelectedItems strSource = varFldr Next Debug.Print strSource & " => " & strDestination 'the paths look fine... 'move folder and its contents If Len(strDestination) Then fso.MoveFolder strSource, strDestination 'ERROR HERE End If End If Set fso = Nothing Set dlg = Nothing End Function |