Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple coding error (Still learning vb)

Status
Not open for further replies.

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 = fso_OpenTextFile("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
 
You either need a reference to the Microsoft Scripting Runtime, or Dim fso as Object.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top