How do I return to BOF in text file (1 Viewer)

NJudson

Who farted?
Local time
Today, 15:30
Joined
Feb 14, 2002
Messages
297
I've been trying to search for an answer but haven't had any luck. What I'm trying to to is loop through a text file but not sure what the correct syntax is to do so. I've worked down through a text file like such:

open "c:\textfile.txt" for input as #1
do until EOF (1)
Line Input #1, a
---Code---
Loop
close #1

Let's say I've reach the half-way point down the text file, how can I return back to the beginning of the file? Should be simple but I'm not finding the answer anywhere.

Currently the only way I can do this is to close the text file then re-open it, but I don't want to do this hundreds or thousands of times through my main code. Thanks for any suggestions.
 

KenHigg

Registered User
Local time
Today, 15:30
Joined
Jun 9, 2004
Messages
13,327
Could you just attach to it and use ado?

???
kh
 

NJudson

Who farted?
Local time
Today, 15:30
Joined
Feb 14, 2002
Messages
297
I'm not familiar with what you're talking about. Never used ADO....just DAO.
 

KenHigg

Registered User
Local time
Today, 15:30
Joined
Jun 9, 2004
Messages
13,327
Basically the same for what you're wanting to do. Access help documents it pretty well.

kh
 

NJudson

Who farted?
Local time
Today, 15:30
Joined
Feb 14, 2002
Messages
297
I'm really retarded I guess. I understand how to manuvere within an access table via the commands:

.movefirst
.movelast
.movenext
.moveprevious
etc

What I don't know how to do is manuever through a text file very well. All I know to do is the "Line Input #1, String" command which moves you down 1 line at a time. Either I'm not searching Access help, this forum, or google correctly or there is no way to move up through a text file or go directly to BOF. My guess is that I'm just not searching with the correct keywords or something. :confused:
 

KenHigg

Registered User
Local time
Today, 15:30
Joined
Jun 9, 2004
Messages
13,327
Have you tried attaching (some call it 'Linking'), directly to the txt file?

kh
 

NJudson

Who farted?
Local time
Today, 15:30
Joined
Feb 14, 2002
Messages
297
I went ahead and just wrote the code so that I just open and close the text file a ton of times when I loop throuhg the code. I'm sure it's not very efficient but it takes no more than several seconds to run. Of course I'd like to write it better, but for all pratical purposes it does work. If I ever get time I may try your suggestions, but Lord knows I'm already trying to squeeze 15 hours worth of work into a 8-9 hour work day! :eek:

Thank you very much for your help.
 

Users who are viewing this thread

Top Bottom