G
Guest
I have a problem with a simple loop through a recordset.
I am using MS Access 2000 to link to a SQL 2000 database.
I have a simple select query that I know returns 86
records. However when I try and iterate through this
recordset to try and find a certain record, Access is
displaying an EOF error after iterating through just 50
records. The code I use is extremely simple:
As you can see I have put a counter in the loop and a
debug.print so that I know exactly where in the loop I
have reached when this EOF error comes up. If I chose to
debug, I can display
and
it's set to TRUE. I can also display
and this is correctly set
to 86. If I display the value of the intRecCount variable
it is 51. The last debug.print line displayed in the
debug window shows:
"RecCount = 50 Trusskey = 41820 EOF = False". The
maxrecords property to 1000.
If I click on f8 to continue debugging, the loops carries
on correctly until it finds the record I am searching
for. It's as if the .EOF marker has been reset?
This is driving me nuts - has anyone come across this
sort of problem before?
Any idea's as to what could be causing Access to rasie
this EOF marker before the end of the recordset?
I am using MS Access 2000 to link to a SQL 2000 database.
I have a simple select query that I know returns 86
records. However when I try and iterate through this
recordset to try and find a certain record, Access is
displaying an EOF error after iterating through just 50
records. The code I use is extremely simple:
Code:
Me.RecordSource = "SELECT * FROM Trusses WHERE
Quantity_Build > 0 AND JobIndex = " & Me.JobIndex & "
Order by MarkOrder"
intreccount = 1
Me.Recordset.MoveFirst
Do Until Me.Recordset.Fields("Trusskey") = gblTrussKeySave
Debug.Print "RecCount = " & intreccount & " Trusskey
= " & Me.Recordset.Fields("Trusskey") & " EOF = " &
Me.Recordset.EOF
Me.Recordset.MoveNext
intreccount = intreccount + 1
Loop
As you can see I have put a counter in the loop and a
debug.print so that I know exactly where in the loop I
have reached when this EOF error comes up. If I chose to
debug, I can display
Code:
me.recordset.eof
it's set to TRUE. I can also display
Code:
me.recordset.recordcount
to 86. If I display the value of the intRecCount variable
it is 51. The last debug.print line displayed in the
debug window shows:
"RecCount = 50 Trusskey = 41820 EOF = False". The
maxrecords property to 1000.
If I click on f8 to continue debugging, the loops carries
on correctly until it finds the record I am searching
for. It's as if the .EOF marker has been reset?
This is driving me nuts - has anyone come across this
sort of problem before?
Any idea's as to what could be causing Access to rasie
this EOF marker before the end of the recordset?