how to delete the dat (or txt) file

T

Tim

After importing a dat (or txt) file into Access and manipulate it, I need to
delete that file on C:\import\. Can you show me how to delete this file.
Thanks!
 
T

Tim

As I stated before, after importing a txt file into Access database, I don't
need that txt file anymore, so that's why I want to delete it to make room
for others. I need to do it programmatically. I already wrote a module for
importing. Maybe I need to add some more codes into this module but I don't
know how to do it yet. Thank you.
 
R

Roger Carlson

OK, if you're using code already, this is easy. Just add:

Kill "C:\import\YourFile.dat"
(replace your actual file name for "YourFile.dat")

If the file changes each time, you can supply the file name via a variable.
How you assign the name to the variable depends on your code, but the Kill
statement would look something like this:

Kill "C:\import\" & Filename
(in this case Filename is a variable that you assigned previously in your
code.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
T

Tim

Got it!!! Thank you very much for your help.
Tim

Roger Carlson said:
OK, if you're using code already, this is easy. Just add:

Kill "C:\import\YourFile.dat"
(replace your actual file name for "YourFile.dat")

If the file changes each time, you can supply the file name via a variable.
How you assign the name to the variable depends on your code, but the Kill
statement would look something like this:

Kill "C:\import\" & Filename
(in this case Filename is a variable that you assigned previously in your
code.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 

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