Stuart McLachlan
stuart at lexacorp.com.pg
Fri Jun 20 16:56:12 CDT 2003
On 20 Jun 2003 at 17:03, Mark Boyd wrote: > This may seem like a strange request, but I've been asked by my boss to > check with this list. > > > > She has a process that exports a 1-record table to a text file. This > text file is then imported into a client's billing system. > > Currently, she is using 'DoCmd.TransferText, acExportDelim ...' to > create the text file. The problem comes about when the other system > tries to read the text file. It kicks back an error stating that it > can't find the end-of-file. > > > > Although, when she simply copies the text from the table, then pastes it > into a text file, the client's system imports it without a problem. > > > > Is there a way (in code) to copy the data from the table to the > clipboard, then paste it from the clipboard to a text file? Why not just do something like the following: (Change the "," to Chr$(9) for Tab delimited) Dim strExport as String Dim rs as Recordset Dim loopcount as long Dim NoOfFields as long Set rs = currentdb.openrecordset("tblSimgleRecordTable") NoOfFields = rs.Fields.Count 'Build comma delimited export string For loopcount = 0 to NoOfFields - 2 strExport = strExport & rs(loopcount) & "," Next strExport = strExport & rs(NoOfFields) - 1) Open "transferfile.txt" for output as #1 Print#1, strExport Close #1 -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support.