Delete Source File

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a server that creates a Comma Del. File that I use Access to retreive
information out of using a macro. My question, is there a way to delete the
source file within the same macro after the data is imported?
 
Greg,

No, not directly with a macro. You will need a VBA procedure, using the
Kill method, to delete the file. You can make a function in a VBA
module to delete the file, and then use a RunCode action in the macro to
make it happen.
 
I am not familiar with VBA, is there a online resource for the procedure?
 
would it be possible to create a BATCH file and run that through the macro?
 
Greg,

In your Database Window, select the Modules tab, and click New. Type
the equivalent of this...
Public Function RemoveFile()
Kill "C:\YourFolder\YourFile.txt"
End Function

Then, put a RunCOde action in your macro, and in the Function Name
argument, put like this...
=RemoveFile()
 
Greg,

Yes. Then use a RunApp action in your macro to run the .bat.
 

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

Back
Top