G
Guest
Hi, everyone!
[Access 2002]
I have a for/next loop that does some serious data manipulation on tables
containing many thousands of records. Occasionally, I want it to stop
processing after several hundred records have been done to check the results,
so I added a "Stop" button to the form to keep me from having to update the
code manually to stop after x records are processed. Just before I start the
loop, I make the button visible, then turn it off when the loop is finished.
I tried using the button to set the loop counter (x) to the "To" value (y)
in the "For x = 1 To y" statement. That did not work.
Next, I tried creating a global variable that is tested just prior to the
"Next x" statement, and set it to False using the button. That didn't work
either.
It's like clicking the button doesn't update the variable, but if I break
into the code, the value is there. (PS: It takes a few seconds for
processing to stop when I hit Ctrl+Break.) If I step through the code, it
works fine.
Does anyone know a neat trick to make this work?
Thanks,
BruceS
[Access 2002]
I have a for/next loop that does some serious data manipulation on tables
containing many thousands of records. Occasionally, I want it to stop
processing after several hundred records have been done to check the results,
so I added a "Stop" button to the form to keep me from having to update the
code manually to stop after x records are processed. Just before I start the
loop, I make the button visible, then turn it off when the loop is finished.
I tried using the button to set the loop counter (x) to the "To" value (y)
in the "For x = 1 To y" statement. That did not work.
Next, I tried creating a global variable that is tested just prior to the
"Next x" statement, and set it to False using the button. That didn't work
either.
It's like clicking the button doesn't update the variable, but if I break
into the code, the value is there. (PS: It takes a few seconds for
processing to stop when I hit Ctrl+Break.) If I step through the code, it
works fine.
Does anyone know a neat trick to make this work?
Thanks,
BruceS