Need some help with the following code. It is a loop that reads and text input file and once it finds some strings it puts the line numbers into a table.
How ever when it finishes it puts the end of line record number into the table but it puts it at the top of the table instead of the bottom. I can't see anything that would cause the record pointer to go back to the top of the file.
Any thoughts.
Thanks
Uncle Mike
Do Until EOF(1) = True
Line Input #1, TextLine
RecCount = RecCount + 1
If Left(TextLine, 15) = "<< /Duplex true" Then
'************************************************************
'Insert the new record into the file
RecSet.AddNew
RecSet![recnum] = XRecCount
RecSet![PageNum] = PageCount
RecSet![AcctNum] = AcctNum
RecSet![NumOfPages] = numopages
RecSet.Update
FirstAcct = False
'*************************************************************
XRecCount = RecCount
PageCount = PageCount + 1
End If
'Check for Account number
If Left(TextLine, 9) = "(Account)" Then
AcctLine = RecCount + 1
FirstAcct = True
End If
'check to see if record count is one more then the line that was
' (Account Number)
If RecCount = AcctLine Then
AcctNum = Left(TextLine, InStr(1, TextLine, ")"))
'Debug.Print acctline, AcctNum
End If
'check for page number
' If Left(TextLine, 10) = "(Page 1 of" Then
If Left(TextLine, 5) = "(Page" And InStr(1, TextLine, "of") > 0 Then
numopages = Left(TextLine, InStr(1, TextLine, ")"))
End If
Loop
'Write EOF to the table
RecSet.AddNew
RecSet![recnum] = RecCount + 1
RecSet![NumOfPages] = "Last Line of the file"
RecSet.Update
How ever when it finishes it puts the end of line record number into the table but it puts it at the top of the table instead of the bottom. I can't see anything that would cause the record pointer to go back to the top of the file.
Any thoughts.
Thanks
Uncle Mike
Do Until EOF(1) = True
Line Input #1, TextLine
RecCount = RecCount + 1
If Left(TextLine, 15) = "<< /Duplex true" Then
'************************************************************
'Insert the new record into the file
RecSet.AddNew
RecSet![recnum] = XRecCount
RecSet![PageNum] = PageCount
RecSet![AcctNum] = AcctNum
RecSet![NumOfPages] = numopages
RecSet.Update
FirstAcct = False
'*************************************************************
XRecCount = RecCount
PageCount = PageCount + 1
End If
'Check for Account number
If Left(TextLine, 9) = "(Account)" Then
AcctLine = RecCount + 1
FirstAcct = True
End If
'check to see if record count is one more then the line that was
' (Account Number)
If RecCount = AcctLine Then
AcctNum = Left(TextLine, InStr(1, TextLine, ")"))
'Debug.Print acctline, AcctNum
End If
'check for page number
' If Left(TextLine, 10) = "(Page 1 of" Then
If Left(TextLine, 5) = "(Page" And InStr(1, TextLine, "of") > 0 Then
numopages = Left(TextLine, InStr(1, TextLine, ")"))
End If
Loop
'Write EOF to the table
RecSet.AddNew
RecSet![recnum] = RecCount + 1
RecSet![NumOfPages] = "Last Line of the file"
RecSet.Update