From: Brig Siton on 6 Apr 2010 10:34 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.
From: Dirk Goldgar on 6 Apr 2010 12:25 "Brig Siton" <bnospamsiton(a)yahoo.com> wrote in message news:e0wzJZZ1KHA.5328(a)TK2MSFTNGP04.phx.gbl... > 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. -- Dirk Goldgar, MS Access MVP Access tips: www.datagnostics.com/tips.html (please reply to the newsgroup)
From: Brig Siton on 7 Apr 2010 10:52
Thank you very much. Brig "Dirk Goldgar" <dg(a)NOdataSPAMgnostics.com.invalid> wrote in message news:1E964BB6-2D72-4F42-B0CB-BD79963B7BAC(a)microsoft.com... > "Brig Siton" <bnospamsiton(a)yahoo.com> wrote in message > news:e0wzJZZ1KHA.5328(a)TK2MSFTNGP04.phx.gbl... >> 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. > > -- > Dirk Goldgar, MS Access MVP > Access tips: www.datagnostics.com/tips.html > > (please reply to the newsgroup) > |