Try this:
(NOTE: requires a reference to DAO)
Code:
Public Sub Export2Txt()
Dim r As DAO.Recordset
Dim k As Integer
Dim sSQL As String
Dim tmpString As String
Dim path As String
'open the text file
k = FreeFile
' Change the text file name to whatever you want
Open "Output.txt" For Output As #k
'open the recordset
'Change the SQL to your SQL
sSQL = "SELECT [Field1], [Field2], [Field3], [Field4] FROM [YourTable]"
Set r = CurrentDb.OpenRecordset(sSQL)
' or if you have a saved query, use
' Set r = CurrentDb.OpenRecordset("YourFilteredQueryName")
If Not r.BOF And Not r.EOF Then
r.MoveLast
r.MoveFirst
'loop through the recordset
Do While Not r.EOF
tmpString = ""
tmpString = "{" & r.Fields(0) & "," & r.Fields(1) & "," & r.Fields(2) & "," & r.Fields(3) & "}"
Print #k, tmpString
r.MoveNext
Loop
End If
'clean up
Close #k
r.Close
Set r = Nothing
'just to let you know when it is over!! :-)
MsgBox "done"
End Sub