Append to Text File is wrong format (1 Viewer)

tvman5683

Registered User.
Local time
Yesterday, 19:48
Joined
Oct 2, 2008
Messages
42
I found this code that appends new data into an existing text file.
But I need the format to be Tab Delimited instead of CSV.
Any help would be greatly appreciated. Here is a sample. The first line was in the table. The second was appended.
line 1 PR 08974 0008180 0836783 PIERCE 26 110 8540395 1.00 A JB

line 2 "PR","08974","0008060","0015917","SERNA ","26","110","285792","1"

JB

Function AppendtoDaily()

Dim MyDB As DAO.Database
Dim rstDR_08974 As DAO.Recordset
Dim intFileNum As Integer
intFileNum = FreeFile()
Open "C:\JBTools\DR_08974.txt" For Append As #intFileNum
Set MyDB = CurrentDb()
Set rstDR_08974 = MyDB.OpenRecordset("DR_08974", dbOpenForwardOnly)
With rstDR_08974
Do While Not .EOF
Write #intFileNum, ![AsstType], ![PDC], ![UNIT], ![TECHID], ![LastName], ![DIV], ![PLS], ![PART], ![QTY], ![UPLD_TRUCKBIN], ![OVERRIDETYPE], ![Analyst], ![ByPassreason]
.MoveNext
Loop
End With
Close #intFileNum
rstDR_08974.Close
Set rstDR_08974 = Nothing
End Function
 

tvman5683

Registered User.
Local time
Yesterday, 19:48
Joined
Oct 2, 2008
Messages
42
Discovered changing WRITR to PRINT removes the "" but the spacing is off

PR 08974 0008180 0714352 BANE 26 110 W10292584 2.00 A JB Not Top 300
PR 08974 0008180 0836783 PIERCE 26 110 8540395 1.00 A JB
PR 08974 0008060 0015917 SERNA M 26 110 285792 1 Null A JVN Top 200
GA 08974 0008150 0000240 EDGAR JOT6 46 106 W10143759 1 Null A JB Top 300
PR 08974 0008150 0000581 KOGAN HRF2 46 106 8201756 3 Null A JB Top 300
 

WayneRyan

AWF VIP
Local time
Today, 01:48
Joined
Nov 19, 2002
Messages
7,122
tvman,

Try:

Print #intFileNum, ![AsstType] & vbTab & ![PDC] & vbTab & ![UNIT] ...

Or

Print #intFileNum, ![AsstType] & Chr(9) & ![PDC] & Chr(9) & ![UNIT] ...

hth,
Wayne
 

Users who are viewing this thread

Top Bottom