Why is this loop slowing down as number of records are processed?
Posted on 2004-03-27
This following code took 13 minutes!
The Label1 counter was fast in the beginning but as the loop progessed it slowed down to a crawl.
Why would this happen and how can i correct it?
lstgVC is a mySQL local database
lstgSrc is msAccess database
Do Until lstgVC.EOF
inCnt = inCnt + 1
Label1.Caption = inCnt & " of " & recCnt
lstgSrc.Open "SELECT id FROM Table1" _
& "WHERE id=" & lstgVC!ID, _
cnSrc, adOpenKeyset, adLockOptimistic
If lstgSrc.RecordCount = 0 Then
lstgVC!Status = "U"
lstgVC!DeleteFlag = 1
lstgVC.CancelUpdate <---------------------note that I'm not even doing an update
outCnt = outCnt + 1
txtStatus.Text = txtStatus.Text & vbCrLf & str
Set lstgSrc = Nothing