TransferText - Append to existing text file

  • Thread starter Thread starter Brig Siton
  • Start date Start date
B

Brig Siton

Is there a way to have table or query exported out to a text file and APPEND
to what is already in the text file instead of overwrite?

Please advise.

Thank you.
 
Brig Siton said:
Is there a way to have table or query exported out to a text file and
APPEND to what is already in the text file instead of overwrite?


TransferText will always overwrite the target file. If you still want to
use TransferText, you can export to a temporary file, then use one of
several possible methods to append that temporary file to the final target
file. Those methods could include (1) using basic I/O commands to read the
temp output file and append its contents to the target file, (2) using the
FileSystemObject and its methods to do the same, or (3) shelling out to a
command-line command to copy-append the files.

Alternatively, you could use your own code to open a recordset on the
table/query, open the target file for append, and loop through the
recordset, formatting and writing output text lines.

Better than that, here is a link to a text-export class object written by
Dimitri Furman that supports appending to the target file:

http://www.mvps.org/access/modules/mdl0058.htm
Modules: Text Export Class

I haven't used it, but I'll bet it works just fine.
 
Thank you very much.

Brig

Dirk Goldgar said:
TransferText will always overwrite the target file. If you still want to
use TransferText, you can export to a temporary file, then use one of
several possible methods to append that temporary file to the final target
file. Those methods could include (1) using basic I/O commands to read
the temp output file and append its contents to the target file, (2) using
the FileSystemObject and its methods to do the same, or (3) shelling out
to a command-line command to copy-append the files.

Alternatively, you could use your own code to open a recordset on the
table/query, open the target file for append, and loop through the
recordset, formatting and writing output text lines.

Better than that, here is a link to a text-export class object written by
Dimitri Furman that supports appending to the target file:

http://www.mvps.org/access/modules/mdl0058.htm
Modules: Text Export Class

I haven't used it, but I'll bet it works just fine.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)
 
Back
Top