Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command button to stop processing 1

Status
Not open for further replies.

InyoTom

Technical User
Feb 4, 2000
33
US
How do I configure a command button to stop a program loop, and return control to the user?

Tom Budlong
TomBudlong@Adelphia.net

 
Hi,

Within your program loop you need a check for a condition.
E.g. define a variable. Set this when the button is clicked.

Within your loop - check for the variable value - if it's set to relevant value then 'Exit sub'.

Regards,

Darrylles "Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
Problem is that the click event for the command button is not executed until the loop is complete. The loop hogs all processing, it seems. Tom Budlong
TomBudlong@Adelphia.net

 
normally control break will stop the loop but i dont think you can put that in a commandbutton "What a wonderfull world" - Louis armstrong
 
Hi Inyo,

Within your loop use a variable to count the number of iterations of the loop and then use doevents:
[tt]
x=x+1
if(x=100) then
doevents
endif
[/tt]

(x=100 can be any value you choose).

Have a look at the DoEvents() function in VB and Access, it interrupts the loop temporarily.

Regards,

Darrylle "Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
By gar that might do it. Good detective work to find this hidden in the bowels of Access Help. Thanks... Tom Budlong
TomBudlong@Adelphia.net

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top