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

copy eof record number to table error.

Status
Not open for further replies.

mikej336

MIS
Feb 10, 2005
164
US
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
 
Is there anyway to ensure that when I do RecSet.AddNew that it goes to the bottom of the table?

Thanks

Uncle Mike
 
Nevermind... I had an index in place that I did not know about..

Thanks to All

Uncle Mike

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top