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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automation of exporting and sending text files with header information 1

Status
Not open for further replies.
Aug 6, 2001
8
GB
Hopefully someone can help with this - I couldn't find any other threads that dealt with this at my level or detail.

I have automated the export of an access table to a txt file and have the sending automated as well - the problem is that the customer wants certain Header and trailer information in as well. It is a fixed width txt file and I can add the trailer info fine - but how do I insert a line of text (header)in front of the first record - effectively carriage returning the records down one space so the first line holds my header information.

regards

JezzBrooks
 
One way that I've done this in the past is to put out a second text file with the header information, then concatentate the two together (using the DOS COPY command with the + operand:

COPY thisfile + thatfile newfile

will concatenate thatfile to the end of thisfile and create a new file called newfile with the results.

You can create the header file using good ol' sequential file VBA code (like we used to do in BASIC):

Dim intFile as Integer
Open "C:\header.txt" For Output As intFile
Print #intFile,"header data"
Close intFile


 
Nice one guys thanks for the suggestions - I have gone with wemeiers so far and it works excellently! That's really helped - I was on a tight schedule on this one.

Excellent!

Regards

JezzBrooks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top