Every now and then I face some exposure to MS Access. And if it comes to exporting data, I get annoyed by the DoCmd.TransferText method which in my humble opinion is a real pain. If you need to refer to an export spec you either face error prone manual maintenance or a comparably high programming effort - especially if your application uses a variable number of fields. I think you are better off by far with this Sub:
Please read my Disclaimer.
Sub Table2Csv(Table As String, Filename As String, _Optional Delim As String = ",", Optional ShowHeader As Boolean = True)'Export database table to csv file, optionally with field headers.'Simpler and safer approach than DoCmd.TransferText plus export specs,'especially when we face a variable number of fields.Dim FileNum As Integer, i As IntegerDim MyDelim As String, NextRecord As StringDim rs As New ADODB.RecordsetFileNum = FreeFileOpen Filename For Output As #FileNumrs.Open "SELECT * FROM " & Table, CurrentProject.connectionIf ShowHeader ThenMyDelim = ""NextRecord = ""For i = 0 To rs.fields.count - 1NextRecord = NextRecord & MyDelim & rs.fields(i).nameMyDelim = DelimNext iPrint #FileNum, NextRecordEnd IfDo Until rs.EOFMyDelim = ""NextRecord = ""For i = 0 To rs.fields.count - 1NextRecord = NextRecord & MyDelim & rs.fields(i).ValueMyDelim = DelimNext iPrint #FileNum, NextRecordrs.MoveNextLooprs.CloseClose #FileNumEnd Sub