Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access 2010 vba got error on either move or delete folder - run time error 70, permission denied 1

Status
Not open for further replies.
Feb 4, 2009
137
US
I have an access database and it's been working for years, suddenly my code stop working on movefolder ....I have full control on admin...
I tried to search but nothing works, please help...

My code:

Private Sub cmdClose_Click()
Dim dest As String
Dim NewDest As String
Dim NewDest1 As String
Dim src As String


Dim FSO As New Scripting.FileSystemObject
dest = "\\Mosquito\Adulticide-Test\Docs\ImportsOps"
NewDest = \\Mosquito\Adulticide-Test\Docs\ArchivedOps\"
DoCmd.Hourglass True

If FSO.FolderExists(dest) Then
If FSO.FolderExists(NewDest & Format(Date, "mm-dd-yyyy")) Then
FSO.DeleteFolder (NewDest & Format(Date, "mm-dd-yyyy")) ''///working on this...
Me.Refresh
NewDest1 = FSO.CreateFolder(NewDest & Format(Date, "mm-dd-yyyy"))
Else
NewDest1 = FSO.CreateFolder(NewDest & Format(Date, "mm-dd-yyyy"))
End If

NewDest1 = NewDest1 & "\"
Me.Refresh

FSO.CopyFolder (dest), (NewDest1)
me.Refresh
fso.DeleteFolder dest ''\\Stop working right here...Run time error 70, Permission denied
fso.CreateFolder (dest)
Else
FSO.CreateFolder (dest)
End If

DoCmd.Hourglass False

DoCmd.Close acForm, Me.Name

End Sub



Please help , Im very appreciated.

Thank you very much

TWEE
 
Any chance your OS was recently upgraded to Vista or Win7?

Beir bua agus beannacht!
 
Yes, it's been recently upgraded from XP to Win7.
BTW, i noticed that after imports all "Reportdl2.cvs" files from that folder into table, I tried to move that folder to the archived folder and re-create the new one or either Copy that folder to archived folder then delete and create the new one but i got error on permisson denied because all those csv files are still opened. That's why i can't move or delete.
Is there any way i can close all those "Reportdl2.csv" files after import them into the table?
I tried to figure it out but I couldn't find any solution.
Right now I just created a batch file and manually delete and recreate that folder for temporary.
Thanks.
Twee
 
Two things:
First, check this out Take ownership of your folders

Also you may have to go into Access trust center and add trusted locations to the files you are manipulating, as well as enabling all macros.

Beir bua agus beannacht!
 
Wow, it does the trick
Thank you very much Genomon.
Now, I'm able to either move or delete a folder has subfolders in it.
Again, thanks. I'm very appreciated.
Twee
 
I dislike the way MS has forced their perceived need for security down our throats. At very least, there should be a "developer version" where we get to set whatever secure features we want. Glad it worked for you!
[cheers]

Beir bua agus beannacht!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top