Dim fFile As Long
Dim strFile As String
Dim strString As String
Dim Rs As Recordset
Dim RsSql As String
fFile = Freefile
'Nominate the output text file path and name
strFile = "C:\FullPath\TextFileName.Txt"
'***You may want to put a check in here to test if the file
'***already exists, and as the user if they want to overwrite it first
'***Use the Kill strFile to delete it first
'Create a snapshot of data from your table with the desired fields and data
RsSql = "Select Field1, Field2, Field5, Etc From TblTableName Where Condition = '" & Criteria & "'"
'Open the recordset and test for EOF
Set Rs = CurrentDb.OpenRecordset(RsSql)
If Not Rs.EOF and Not Rs.BOF Then
Open strFile For Output As #fFile
Do Until Rs.EOF
'Loop across all fields in recordset delimiting them with a tab key
For i = 0 To Rs.Fields.Count -1
strString = StrString & Rs(i) & vbTab
Next
'Output the resulting string to the text file
Print #ffile, strString
'Reset the string to empty for the next record
strString = ""
'Move to the next record in the recordset
Rs.MoveNext
Loop
'Close the recordset and the text file
Rs.Close
Close #fFile
End If
'Destroy the instance of the recordset from memory
Set Rs = Nothing