Question Copy external files to the database

Accessosaurusrex

Registered User.
Local time
Today, 15:05
Joined
Oct 18, 2010
Messages
28
I have gone through the forums and have found some helpful answers but I lack the skill to close the loop.

My database is updated several times a day and receives its data from a CSV or TXT file. My problem is that I need to clear the text from the file when it is updated in the database or, as an alternative, copy a blank file of the same name over this file to achieve the same goal.

This is an easy enough process external to Access, however, I would love to be able to accomplish that as part of a macro internal to the program. I have found some VBA information that is theoretically what I need, but not sure how to get that in to a functional use for the database. The users will not be heavily computer-minded people. I have an existing macro that does all the house-keeping internal to the database and was wondering if there was some way to simply add a line entry into the macro to go outside the dbase and perform a filecopy function?

I am using Access 2003.

Thanks for your time!
 
I think the easiest solution is to copy a blank file over the used file, as you have suggested. This can be done from a VBA Routine with the FileCopy() function.
Code:
Public Function myCopy()
   FileCopy "C:\myData\blank.txt" "C:\myData\inputdat.txt"
End Function

If you want run this function from a Macro then use the RunCode Action and call the function myCopy().
 

Users who are viewing this thread

Back
Top Bottom