Missing Field Names

paulS30berks

Registered User.
Local time
Today, 16:12
Joined
Jul 19, 2005
Messages
116
Just used the code below to output to .csv. however Field Names have been omitted from the output .csv file.

Can anyone help?

Thanks

Paul

Private Sub export_Click()
On Error GoTo Err_export_Click
Dim AString As String
AString = "Export_Occupancy_"
DoCmd.TransferText acExportDelim, "", "ChildCare Vouchers For Accor", "c:\\Temp" & AString & Format(date, "YYYY_MMDD") & Format(Time, "-HH_MM") & ".csv"
Exit_export_Click:
Exit Sub
Err_export_Click:
MsgBox Err.Description
Resume Exit_export_Click
End Sub
 
The DoCmd.TransferText statement should read:

DoCmd.TransferText acExportDelim, "", "ChildCare Vouchers For Accor", "c:\\Temp" & AString & Format(date, "YYYY_MMDD") & Format(Time, "-HH_MM") & ".csv", True

This will include the field names in the CSV file.
 

Users who are viewing this thread

Back
Top Bottom