how do i delete a text file using ACCESS VBA code

G

Guest

I am willing to delete a text file after i use it by using VBA code while my
form is running
 
G

Guest

to delete a file using VBA:
Kill "c:\yourfolder\yourfile.txt"

You may want to put some kind of if statement in to make sure the file
exists first.

Hth

Stu
 
J

Jamie Collins

I am willing to delete a text file after i use it by using VBA code while my
form is running

Tongue slightly in cheek:

CurrentProject.Connection.Execute _
"DROP TABLE [TEXT;DATABASE=C:\FolderNameHere\;].FileNameHere#txt;"

Jamie.

--
 
J

John W. Vinson

I am willing to delete a text file after i use it by using VBA code while my
form is running

Tongue slightly in cheek:

CurrentProject.Connection.Execute _
"DROP TABLE [TEXT;DATABASE=C:\FolderNameHere\;].FileNameHere#txt;"

Jamie.

<g>

Yeah, that'd work.

Sort of like using a helicoptor rotor as a hedge trimmer though...

John W. Vinson [MVP]
 
J

Jamie Collins

Tongue slightly in cheek:
CurrentProject.Connection.Execute _
"DROP TABLE [TEXT;DATABASE=C:\FolderNameHere\;].FileNameHere#txt;"
<g>

Yeah, that'd work.

Sort of like using a helicoptor rotor as a hedge trimmer though...

I figured the OP had in the title emphasized ACCESS VBA, as distinct
from vanilla VBA, so I thought, "What's the most _*ACCESS*_ way of
deleting a file...?" ;-)

Jamie.

--
 
J

John W. Vinson

I figured the OP had in the title emphasized ACCESS VBA, as distinct
from vanilla VBA, so I thought, "What's the most _*ACCESS*_ way of
deleting a file...?" ;-)

Nah. None of us Access rubes ever use DDL; "DROP TABLE" is a foreign
language! :-{)


John W. Vinson [MVP]
 

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