al4629740
asked on
run code on the last record of a loop
I am trying to run the following code within a loop. If I am on the LAST record in the loop I want the If/Then statement below to run, but its not running. How can I make line 6 run on the very last record of the recordset in the loop?
Do Until rec1.EOF = True
'More code here
If rec1.EOF = True Then
HoursServed(i) = HoursServed(i) & " Total = " & LoopTotal
End If
Loop
ASKER
This is where it happens. Same problem
Do Until rec1.EOF = True
'More code here
If rec1.EOF = True Then
HoursServed(i) = HoursServed(i) & " Total = " & LoopTotal
End If
rec1.MoveNext
Loop
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent suggestion
such as rec1.MoveNext(). I'm presuming that you do that AFTER the rec1.eof check. you should do that right before.