Link to home
Start Free TrialLog in
Avatar of avoorheis

asked on

Access macro / vba code transfertext not over writing files.

I have set up several macros and some vba routines that use the transfer text or transfer spreadsheet commands to create files on various network folders. These routines, I thought, would just overwrite the existing files. In fact, I've tested each one several times to make sure (like changing the data, run the routine and then making sure the data had been updated).

I happened to review one of the files and found that the data had not been updated, even though the timestamp of the file showed that it had been modified that day. When I found this, I deleted the file and re-ran the code, which created the file with the correct data. I even ran my test again where I modified the data in the file and re-ran the code to make sure the data was updated and it was.

The only thing I can figure is that if someone else opens the file and saves it, something happens to the permission and access won't actually overwrite the data, even though the modified date was changed and Access did not report any problem.

Since I've found this, I've implemented changes that will just delete the existing file before updating (so, just creating a new file each time).

My actual question is can someone confirm what I believe is happening or have a different explanation?

Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of avoorheis


Thanks for confirming my assumption. I believe it has to do with the way our network folders are implemented and how Access interacts with those rules. I'll implement your strategy where I can, otherwise, I'll just delete the old file first.