-----Original Message-----
Hi Brian,
Sometimes it's possible to use a cunning union query that returns a
dummy first record with the header information, followed by the records
you want to export. Start by modifying the query you're currently
exporting so it returns a single text field containing the line that
needs to go in the textfile, delimiters and all, e.g.
Rec: [ID] & Chr(9) & [LastName] & Chr(9) & [FirstName]
The union query will be something like
SELECT "This is the header information" AS Rec,
0 AS IsData FROM AnyTable
UNION
SELECT, 1 AS IsData Rec FROM TheQuery
ORDER BY IsData;
Then export the union query.
Otherwise, the choice is basically between
a) Create the textfile in the usual way and then prepend the header
record (e.g. by writing the header to another textfile and then using
something like
Shell("COPY " & strHeaderFileSpec & " + " & strDataFileSpec _
& " " strFinishedFileSpec)
to concatenate them)
b) Create the entire file from VBA: first write the header line and then
iterate through the recordset assembling each record's fields into a
string which is written to disk.
I need to export a delimited recordset everyday...that's
no problem. But I need to have a header record that
contains the supplier name, today's date, and the number
of records that follow.
Does anyone have any ideas on the best way to do this?
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
.