Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Access to generate a flat file 2

Status
Not open for further replies.

spalmer

Technical User
Feb 29, 2000
2
US
I am trying to use access to generate a flat file to simulate a file we are receiving from an ERP system.&nbsp;&nbsp;The text file is relatively small.&nbsp;&nbsp;Header, Trailer, and detail record type, but there is one detail record per each order.&nbsp;&nbsp;I created a table for each record type and then export them as text files.&nbsp;&nbsp;How can I link all three record types so that Access generate a single text file using all three tables?&nbsp;&nbsp;Does this make sense?&nbsp;&nbsp;Is this even possible?<br>I would like to total all units sold to include correct data on the trailer record.&nbsp;&nbsp;Am I asking for the world from Access?&nbsp;&nbsp;Any other ideas?<br>Thanks from QA!<br>
 
Hi!<br><br>If you could pre-link the tables using queries, you can export both reports and queries as different types of txt-files. But I don't think that answers your question.<br><br>To do this, with enough control, you probably have to use VBA-Code, loop through your recordsets and write each record to a txt-file, line by line.<br><br>open &quot;text.txt&quot; for output as #1'<br>print #1, &quot;Some text&quot;<br>print #1, strString<br>do while not rst.EOF<br>print #1, rst!field<br>rst.movenext<br>loop<br>rst.close<br>close #1<br>
 
Thanks RV!&nbsp;&nbsp;I will give this a try.&nbsp;&nbsp;I think I can manage it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top