jomusichn
11-23-2004, 02:36 PM
I have a query (Called qselSWBCInsurance) that I need to export to a Coma delimited text file (CSV), through the use of a macro. MS Help is usless.
Can anyone here help a hopless newbie?
Thanks,
John
PS
I am using access 2000
jomusichn
11-23-2004, 02:51 PM
The transfer text option must use a table not a query.
Kicker
01-16-2005, 09:24 AM
then why not use a make-table query and then export that table?
Use the method OutputTo instead of TransferText.
RV
Matthes
01-31-2005, 06:50 AM
hi jomusichn,
i´m know, that by now your problem will allready be solved, but if you still want to export a query to a csv you might try the sub below.
(i got it from somewhere on this board i think, but cant´t remember where...sorry...actually it´s merged from 2 different posts, since it exports the query and sets date/time within it´s name)
hope you or someone else might find this helpful
---------------------------
Private Sub export_Click()
On Error GoTo Err_export_Click
Dim AString As String
AString = "Export_Auftraege_"
DoCmd.TransferText acExportDelim, "Aufträge Exportspezifikation", "qry_Eingabe_Aufträge", "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
---------------------------
you will have to use export definitions (? sorry, don´t know the english phrase) where you set variables for the export (like the signs used for field separations etc.)
so the basic layout will be:
DoCmd.TransferText acExportDelim, "export definitons name", "query name", "path" & AString & Format(Date, "YYYY_MMDD") & Format(Time, "-HH_MM") & ".csv"