Solved

How to erase all files in a Directory within MS Access

Posted on 2012-03-22
4
256 Views
Last Modified: 2012-05-09
Hi guys, I'm trying to write a procedure that:
1)Allows me to erase all the files within a specified directory.
even if
2)The directory is empty.

Thanks!
0
Comment
Question by:Vellenaweth
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37755689
Kill "C:\YourFolder\*.*"
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37755695
In a lot of systems "Kill" is not allowed...

In that case you can use the "FileSystemObject"
See here:
http://www.freevbcode.com/ShowCode.asp?ID=2381
0
 

Author Comment

by:Vellenaweth
ID: 37758526
Yep, the "kill" stuff gives me a "File not found".
Gonna try the other solution.
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 170 total points
ID: 37758710
Well, "File not found" means just that...
It could not find the file.
Be *sure* to check your spelling...
..Check the spelling of the *Folder* as well.

If the file you specify is MyName.txt,
 but the actual file name is: MyName1.txt
...Then any system will display "File not found"
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

623 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