Exporting a query to a csv file

jamsta

Registered User.
Local time
Today, 18:32
Joined
Oct 29, 2009
Messages
26
Hello all,

I am trying to write some code to export query results to a csv file. I've read a few threads in this forum on the subject but none quite solve my problem.

I have this line of code:

DoCmd.TransferText acExportDelim, "1spec", "qry_SBI_NAME_ADDRESS", strDBPathAndFile & "\Exports\SBI_NAME_ADDRESS.csv"

I have defined the export specification "1spec" through the advanced tab in the export wizard. My problem is that I checked the option to include the column headers as the first row, and yet they are being omitted. Other than that, the file is exporting fine.

Does anyone have any suggestions?
 
It isn't in the spec that the field names are included. It is in the transfertext code:
Code:
DoCmd.TransferText acExportDelim, "1spec", "qry_SBI_NAME_ADDRESS", strDBPathAndFile & "\Exports\SBI_NAME_ADDRESS.csv"[COLOR="Red"][B], TRUE[/B][/COLOR]
 
Doh!

Thanks very much for you help Bob. I like it when the answer is straight-forward. It worked a treat.
 

Users who are viewing this thread

Back
Top Bottom