Cannot delete directory after creating it

G

Guest

I have code in several places that creates directories and I’ve noticed
several times that after I’m done testing and try to delete the directories,
I get the following error message:

"Cannot delete xxx: It is being used by another person or program.

Close any programs that might be using the file and try again."

The code I’m using is simple:

If Dir(RetreivePath & "\Invoice\", vbDirectory) = "" Then
MkDir (RetreivePath & "\Invoice\")
End If

Maybe I have to close something out in code, but I can’t figure it out. Any
suggestions would be much appreciated.

Thanks,
Clint
 
G

Guest

Hi there. Sorry for not being more detailed. I'm running code to test the
creation of folders and then delete them when I'm done testing. The deletion
is manual, but I suspect that trying to delete the folder via code will
result in the same error.

Deleting folders will be an option for my users when I release the DB, so it
is possible that someone could create a folder by mistake and want to delete
it very soon after creation.

Also, eventually the folders in question are "released" and can be deleted.
I believe every time I've closed Access down in my testing, I could
immediately delete the folders. It seems that the hold up is related to
Access.

Thanks!
 
D

DAVID

Check that you haven't left a file open.

If you put a database there, check that you haven't
left a database open.

Turn off the BackGround Inteligent Transfer Service
on your PC (the 'BITS' service).

If that doesn't help, turn off drive caching in the
hard drive properties.

If that doesn't help, check your permissions.

There is nothing in the code shown that would indicate
a problem.

(david)
 

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

Top