Solved

How to erase all files in a Directory within MS Access

Posted on 2012-03-22
4
255 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Outlook 2016 VB code syntax 4 38
Why can't I change data in my query? 3 38
Tabbed form question 5 21
Access 2010: Combo Box Query 5 19
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

759 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