Form acces during intensive subroutines

Here is my situation.

I have a form that kicks off
an intensive subroutine that loops through some data and does a bunch of inserts into a DB.  During this process, I want to pop open another
form that allows the user to click a cmdbutton to cancel the operation.  I can do the rollback and all that.  My problem is in actually being able to get the cancel form to respond to the users click.  Since the app is responding to the subroutine and doing all of its inserts it seems to hold the form that the routine is in hostage.  I cant do anything else.

I have always had form problems of this type in VB (i.e. when doing something intensive you usually can't move the current form around, minimize it, etc)
and have never really been able to solve them.

Any ideas?
Thanks a bunch.
jogmenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mcriderCommented:
You need to put a DoEvents Statement in your loop... This will yield processor time away from the loop and allow other events to fire...


BE CAREFUL when doing this... make sure you dont fire the same event more than once...

For example, lets say you have a commandbutton that kicks off you loop...

If you dont disable the commandbutton when you start the loop and enable it again when the loop ends, your user could press the commandbutton twice and get the loop going 2 times...


Cheers!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mcriderCommented:
Thanks for the points! Glad I could help!


Cheers!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.