DwayneS
Instructor
- Mar 29, 2002
- 70
I have code I'm borrowing from others on this forum and am trying to use it to read a very large and messy spool file a line at a time so I can parse out information I need for accounting.
My code errors out in the Dim statements. Here's the code I'm trying to construct:
Private Sub ReadTextFile_Click()
Dim fso As FileSystemObject
Dim STREAM As TextStream
Dim CurLine As String
Dim arrValues() As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblTextFileImport", dbOpenDynaset)
Set fso = New FileSystemObject
'OPEN THE TEXT FILE
Set STREAM = fspenTextFile("F:\scanfile.txt")
'LOOP THRU THE TEXT FILE ONE LINE AT A TIME
While Not STREAM.AtEndOfStream
'READ THE LINE
CurLine = STREAM.ReadLine
Wend
etc ----- I'm going to gather parts of the line and combine it with data on the next line to make a record.
Dwayne Streeter, CPA, CITP
My code errors out in the Dim statements. Here's the code I'm trying to construct:
Private Sub ReadTextFile_Click()
Dim fso As FileSystemObject
Dim STREAM As TextStream
Dim CurLine As String
Dim arrValues() As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblTextFileImport", dbOpenDynaset)
Set fso = New FileSystemObject
'OPEN THE TEXT FILE
Set STREAM = fspenTextFile("F:\scanfile.txt")
'LOOP THRU THE TEXT FILE ONE LINE AT A TIME
While Not STREAM.AtEndOfStream
'READ THE LINE
CurLine = STREAM.ReadLine
Wend
etc ----- I'm going to gather parts of the line and combine it with data on the next line to make a record.
Dwayne Streeter, CPA, CITP