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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Break A Gosub Reading Data

Status
Not open for further replies.

pianoman

Programmer
Oct 2, 2000
4
US
Am reading 75000 records in a sequential file then updating access database using RDO. Want to be able to break out with button on form to stop process. Cannot get gosub to stop when pressing stop button.
Is there a way in a gosub to test for a key hit then take action. Why shouldn't button key press do the same thing?
Thanks to anyone for some help. [sig][/sig]
 
Try dimensioning a public boolean variable at the module level, setting the value of the variable to True in the command button Click event and then testing the value of the variable in the subroutine immediately following a DoEvents command.

The DoEvents will have an effect on performance but I don't believe there are any other easy ways to accomplish the task.
[sig]<a href=mailto:CraigL@bc-corp.com>CraigL@bc-corp.com</a><br>[/sig]
 
Doubt you'd be able to tell the difference, without some very careful measuring, if you included a gosub....

what about like this:

CarryOnLooping = True
while(CarryOnLooping)do
your_other_code_here
doevents
loop

and set the value of CarryOnLooping to False in a Command_Click event, as Craig says [sig]<p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>Making mistakes, so you don't have to. &lt;grin&gt;[/sig]
 
Thanks to you all -It worked just fine - Can't really tell the difference. This was my first time on this site. Great to have you all out there [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top