Strange Problem with Scripting.FileSystemObject


Joined
Jul 6, 2010
Messages
5
Reaction score
0
SOLVED: Strange Problem with Scripting.FileSystemObject

Hello,

I have some simple code that used to work in Access 2000 and now gives me a strange problem in Access 2003.

I can delete a file in, and copy a file into, my c:\ root directory, but when I try it in a sub-folder under C:\Program Files, I get Run-time error 70 (permission denied).

My client is getting the same problem on his network as well.

Here is the code:

Set fs = CreateObject("Scripting.FileSystemObject")

'This code No Longer Works:
fs.DeleteFile ("c:\Program Files\ABC_Systems\is-data.mdb")
fs.CopyFile "F:\ABC_Systems\is-data.mdb", "c:\Program Files\ABC_Systems\", overwrite

'This code Works Fine:
fs.DeleteFile ("c:\is-data.mdb")
fs.CopyFile "F:\ABC_Systems\is-data.mdb", "c:\", overwrite

Thank you in advance for any help.

Peter
 
Last edited:
Ad

Advertisements

Joined
Jul 6, 2010
Messages
5
Reaction score
0
Upon further thought and research, this must be due to a lock still existing on the file I'm trying to copy.
I'm trying to copy the file from the F: drive to the C: drive as the user is about to disconnect from the network and needs to take copies of certain files with him.
This is happening just as he's closing the main menu form and is about to encounter "Exit" in the next line of code.
How do I release the lock programmatically to allow this file to be copied?

Thanks,
Peter
 
Ad

Advertisements

Joined
Jul 6, 2010
Messages
5
Reaction score
0
Solved by original poster.

I had mistakenly linked a table from the C: drive instead of the F: drive so there was a lock (found the LDB file) on the C: file I was trying to delete and refresh.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top