When looping through records, it is easy to create an endless loop by omitting the line rst.MoveNext. Your code then becomes stuck in an endless loop.
Solution:
VBA is more forgiving than most other languages: just press Ctrl+Break to break out of the loop.
Hint:
Even in a quick'n'dirty procedure, a progress indicator lets you know if a loop is stuck. The simplest reports every 100th record in the loop like this:
i = i + 1
If i Mod 100 = 0 Then 'Mod gives the remainder of i divided by 100.
DoCmd.Echo True, i
End If
No comments:
Post a Comment