You are probably using an integer as your counter?
integers have a max value of something like 32767 and a lower limit of -32768. Check to see if the count overflows with the same number every time. I bet it does.
try using a long
Feedback response number CTYR8VHJF8 created by Carl Tyler on 06/22/2012
Overflow error at counting docs (Gabrielle R Cou... 22.Jun.12) . . You are probably using an integer a... (Carl Tyler 22.Jun.12) . . . . It Worked! (Gabrielle R Cou... 22.Jun.12)