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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

referring to .txt file

Status
Not open for further replies.

steve229922

Technical User
Mar 9, 2004
8
US
as a new vba programmer, i'm trying to decipher some code that looks at a text file saved outside of access then runs thru a series of steps that parses it. Here is the first part of the code--

Public Function getitdone2()
Dim lFileHandle As Long
Dim sFileName As String
Dim sLine As String
Dim sData() As String
Dim sFieldName As String
Dim sFieldData As String
Dim sSQL As String
Dim bNames As String
Dim bValues As String

lFileHandle = FreeFile()
sFileName = "person1.txt"

Open sFileName For Input As lFileHandle

Do While Not EOF(lFileHandle)

I'm guessing the FreeFile() is a procedure that gets the person1.txt file and 'holds' it so it can be processed by the rest of the program.

Can anyone give me some tips on how to write a procedure that might do what it's asking???

Please help, Thanks!!!!
 
Hallo,

The open instruction is the one which opens the file.
The opened file is identified by a number, in your case held in IFileHandle.
The FreeFile instruction assigns an available file handle.
Hope that makes sense.

Quote:Can anyone give me some tips on how to write a procedure that might do what it's asking???

What do you mean 'what it's asking'?

Use Line Input #IFileHandle, sLine to read in a line.
Don't forget to Close #IFileHandle when you've finished with it.

- Frink
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top