Move Down a Line

mlr0911

Registered User.
Local time
Yesterday, 20:16
Joined
Oct 27, 2006
Messages
155
Hello all, I have some VB code that I am working with that reads a text file. The code reads the text file perfectly, however, how can I tell the code to import the data on the next line?

Here is an example what I have so far:
If (UCase(Mid(strRecord, 1, 8)) = "Security") Then

strOldSecNum = Mid(strRecord, 22, 110)

How can I tell the above to move down 1 record and get that information.

Thanks in advance.
 
every time you read a line the cursor is positioned at the next line.
So by issuing another line read you will get then next line,

however you need to take care of End Of File. this is from Access Help

This example uses the Line Input # statement to read a line from a sequential file and assign it to a variable. This example assumes that TESTFILE is a text file with a few lines of sample data.

Dim TextLine
Open "TESTFILE" For Input As #1 ' Open file.
Do While Not EOF(1) ' Loop until end of file.
Line Input #1, TextLine ' Read line into variable.
Debug.Print TextLine ' Print to Debug window.
Loop
Close #1 ' Close file.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom