Hey Gurus,
I'm trying to export a query (QueryDataExpor t) to a comma delim CSV file. The file name should look like this "C:\DSF_2006112 7_124211.csv" however it is exporting as "C:\DSF_.cs v".
Also all of the text fields and header are being exported with quotes "" around them and I'm unsure how to turn this off. Do I have to actually have to create a rst and then code it to go through and remove these manually or is there a function switch of some kind?
Here's what I've done:
Private Sub cmdExport_Click ()
On Error GoTo Err_cmdExport_C lick
Dim MyDate
Dim MyFile
Dim Mystring
MyDate = Now()
Mystring = Format(MyDate, "yyyymmdd_hhmms s")
MyFile = "C:\Customer\DS F_BWS_" & My_String & ".csv"
DoCmd.TransferT ext acExportDelim, , _
"QueryDataExpor t", MyFile, True
Exit_cmdExport_ Click:
Exit Sub
Err_cmdExport_C lick:
MsgBox Err.Description
Resume Exit_cmdExport_ Click
End Sub
Which outputs as:
"Centre","Date" ,"Dept","Sales" ,"Count","Units ","Division "
"1111","2006112 6","0",2,"0","0 ","10",0
"1112","2006112 6","0",4,"0","0 ","10",0
However I'd like it to look like this:
Centre,Date,Dep t,Sales,Count,U nits,Division
1111,20061126,0 ,2,0,0,10,0
1112,20061126,0 ,4,0,0,10,0
Thanks for any help you can provide
Cheers,
Cz. :)
I'm trying to export a query (QueryDataExpor t) to a comma delim CSV file. The file name should look like this "C:\DSF_2006112 7_124211.csv" however it is exporting as "C:\DSF_.cs v".
Also all of the text fields and header are being exported with quotes "" around them and I'm unsure how to turn this off. Do I have to actually have to create a rst and then code it to go through and remove these manually or is there a function switch of some kind?
Here's what I've done:
Private Sub cmdExport_Click ()
On Error GoTo Err_cmdExport_C lick
Dim MyDate
Dim MyFile
Dim Mystring
MyDate = Now()
Mystring = Format(MyDate, "yyyymmdd_hhmms s")
MyFile = "C:\Customer\DS F_BWS_" & My_String & ".csv"
DoCmd.TransferT ext acExportDelim, , _
"QueryDataExpor t", MyFile, True
Exit_cmdExport_ Click:
Exit Sub
Err_cmdExport_C lick:
MsgBox Err.Description
Resume Exit_cmdExport_ Click
End Sub
Which outputs as:
"Centre","Date" ,"Dept","Sales" ,"Count","Units ","Division "
"1111","2006112 6","0",2,"0","0 ","10",0
"1112","2006112 6","0",4,"0","0 ","10",0
However I'd like it to look like this:
Centre,Date,Dep t,Sales,Count,U nits,Division
1111,20061126,0 ,2,0,0,10,0
1112,20061126,0 ,4,0,0,10,0
Thanks for any help you can provide
Cheers,
Cz. :)
Comment