Header on text file?

IanMilly

Registered User.
Local time
Today, 01:25
Joined
Jun 1, 2004
Messages
46
Hi,

I automatically create files via access, then I am sending lots of data to those text file (well an .sql file to be exact) as strings.

I have the transfer working great, everything is working fine
Code:
Print #iFileNumber, sTheDataIAmPassing

What I want to have is a header on the page automatically transfered from access. How can i do this?


I guess this will be a v easy one, but i can't find any solutions for it.


Thanks

Ian
 
Ian,

What should be in the File Header??

It's just more Print statements, but where should the info come from?

Wayne
 
Hi Wayne,

The info required to be used as a header is just a string. I have this info from a text box on a parent form.

What is the print statement to make the text a header on the text file?

Thanks

Ian

(When i say header i mean as in header and footer -not just a title )
 
Ian,

Simplistic, but a start ...

Code:
Dim dbs As Database
Dim rst As Recordset
Dim intLine as Integer

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Select * From YourTable Order by Something")
Open "C:\SomeFile.txt" For Output As #1

While Not rst.EOF and Not rst.BOF
   Print #1, "This is a header ..."
   Print #1, Me.YourTextBox
   Print #1, "End Of Header"
   For intLine = 1 to 40
       Print #1, rst!Field1;" ";rst!Field2;" ";rst!Field3
       rst.MoveNext
       If rst.EOF Then Exit For
       Next intLine
   Print #1, "This is a footer ..."
   Print #1, Me.YourTextBox
   Print #1, "End Of Footer"
   If Not rst.EOF Then rst.MoveNext
   Wend
Close #1

Wayne
 

Users who are viewing this thread

Back
Top Bottom