In the 2nd loop try moving the line "objRecordset.MoveNext" outside of the "flag=true" If block - otherwise it will just be stuck in a loop as soon as it finds a record where flag = false.
Alternatively, why do you bother looping thro the records twice? Why can't you process both the flag=false and the flag=true cases in a single loop?
hth
phil
|