Processing last record

Malcy

Registered User.
Local time
Today, 07:42
Joined
Mar 25, 2003
Messages
584
I am having an issue with major processing in recordset of around 1500 records.
I start the loop with
Code:
While Not rstAprProp.EOF
and I end the loop, many lines of code later with
Code:
' Move to next record
    rstAprProp.MoveNext
    
' Repeat the cycle
    Wend
Every single record except the last one is processed with glorious accuracy but the final record is not touched. Presumably the .EOF is showing true, but I thought this happened on the first new record at the bottom of the recordset not the last record.
Can anyone set me straight please since I am feeling a ninny!
Thanks and best wishes
 
Try not using
Code:
While Not rstAprProp.EOF
 ...your code here
Wend


try using this instead:
Code:
Do Until rstAprProp.EOF
... your code here
Loop
 
Thanks for such a swift reply Bob
I have made change and will test - it takes a while to run through.
Just out of curiosity why use the one not the other? I presume less "thinking" needed by vba or is it just I learned an older device that has worked ok on less demanding processing?
Best wishes
 
Thanks for help. It still glooped at the last record so moved processing loop to
Code:
' Load the first record
'    rstAprProp.MoveLast
    rstAprProp.MoveFirst
    
' Set the counter
    lngRpt = 1
    
' Start the looping
    Do Until lngRpt = lngCount
Where lngCount is taken from a DCount of all records in recordset that need to be processed. Added a wee lngRpt = lngRpt+1 at end of the loop before the movenext
Feeling much happier now!
 
i think there must be something else going on

while not rs.eof
{process record}
rs.movenext
wend

will work ok

----------------
what might happen is that if you are grouping/testing whether a record is the same as the previous one, the LAST record/group ALWAYS needs processing outside the loop
 

Users who are viewing this thread

Back
Top Bottom