Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to erase all files in a Directory within MS Access

Posted on 2012-03-22
4
Medium Priority
?
260 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
  • 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 510 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

916 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