Run/Stop process by shifting in/out of a controlbox

W

Winnetou

I would like to activate/desactivate a process (a VBA procedure) by
shifting the focus on/away from a controlbox. Starting the process is
fairly trivial, but stopping it stumps me. I don't know how to abort
the procedure once the process has started (DoEvents, etc.) It seems
to me that once Access is busy running a task, it ignores GUI
interrupts such as lost focus etc. until the process has been
completed.

Is there an simple method to stop a process once the focus is shifted
away from the controlbox?

Thanks for your feedback.

Mark
 
P

PC Datasheet

Here are a couple of ideas to think about ---
1. Control - Break stops code that is running. If you find some way to
programatically press those keys simultaneously, you should be able to stop your
procedure.
2. If your procedure has many distinct steps to it, you could put code in the
routine at each step to check something external that you could change while the
procedure is running. If the code finds a change at a step, you could direct the
code to go directly to the end of the procedure.
 
P

PC Datasheet

Just thought of something else ---

If you had a way in your procedure to open the post directly below your post
(starts with 'Movie Star') at your command, you'd probably stop everything
rather quickly!!!

Steve
PC Datasheet
 
C

Chris Nebinger

You'll need to run DoEvents to release processing back to
the GUI. Then use the
Screen.ActiveForm.ActiveControl.Name to determine the name
of the current control on the current form.

Do Until Screen.ActiveForm.ActiveControl.name
<> "ControlName"
DoEvents
Loop


Chris Nebinger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top