I am trying to export a database query to a csv file. This has been successful for the most part, but I have come across a couple of problems.
1. The first problem is that the resulting file does not have any headers, only the data fields. The output only contains 6 fields and should be named Month, Reference,Account,Dr,Cr,Description.
2. The second problem, is that the resulting date in the text file shows as "31/01/2006 00.00". Is there any way of getting rid of the time portion of the date field?
Relevant code is:
1. The first problem is that the resulting file does not have any headers, only the data fields. The output only contains 6 fields and should be named Month, Reference,Account,Dr,Cr,Description.
2. The second problem, is that the resulting date in the text file shows as "31/01/2006 00.00". Is there any way of getting rid of the time portion of the date field?
Relevant code is:
Code:
Private Sub cmdReceivables_Click()
'Stop
Dim strDocName As String
Dim strExport As String
Dim strFileName As String
Dim strCoy As String, strDate As String, strFormat As String
strDocName = "JOURNALEXPORT" ' Name of the query to export
strExport = "JOURNAL" 'Export Specification
strCoy = Me.cboCoy ' name of Combo box specifying company
strFormat = "mmm-yy"
strDate = Format(Me.cboDate, strFormat)
strFileName = "C:\Documents and Settings\LLockett\My Documents\Work\General Ledger\" '
strFileName = strFileName & strCoy
strFileName = strFileName & strDate
strFileName = strFileName & "JNLASSETS.csv" ' File location and name
DoCmd.TransferText acExportDelim, strExport, strDocName, strFileName, False
End Sub