Solved

delete file permission denied using vb6

Posted on 2010-08-14
5
1,142 Views
Last Modified: 2012-05-10
I am trying to Delete a text file but keep getting a permission denied error. I can Copy it but cannot Move or Delete it.
0
Comment
Question by:DblTMO
5 Comments
 
LVL 1

Expert Comment

by:odd lie
ID: 33437166
This can happen when someone has the file in use, try to chech if the file is in use,
If in use , try to find the owner of the file and close that connection.

regards
Oldelphi
0
 

Author Comment

by:DblTMO
ID: 33437181
I am the owner. I am Importing the file into Access then St the FSO = Nothing. After that I need to Copy the file to a Backup directory. After the Copy I need to Delete the orginal.
0
 

Expert Comment

by:sha_josh
ID: 33437429
You can delete using command prompt if you have any issues with deleting using Explorer.
1. Open command prompt
2. type this below command. I have used c:\windows\test.tmp as example file you want to delete:
del /f /q c:\windows\test.tmp

This should work!
Cheers
0
 
LVL 17

Expert Comment

by:Zhaolai
ID: 33438366
Try this:

    Dim FSO As Object
    Set FSO = CreateObject("Scripting.FileSystemObject")
    FSO.DeleteFile "FileToBeDeleted", True


0
 

Accepted Solution

by:
DblTMO earned 0 total points
ID: 33438399
I would like to thank those who offered solutions.  They would all worked if I had closed the Text Object. I had closed all the FSO but not the TSO. Sometimes it the easy/obvious things that stop you.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now