Stop all VBA code running

J

Jim Franklin

Hi,

Can anyone tell me if there is a way of terminating ALL vba code which is
running in an Access 2003 application?

I have an form which contains a Winsock control to communicate with a remote
device on the network. Periodically I am getting a Winsock Error "10054: the
connection is reset by server side." after which I cannot communicate with
the remote device. I am trying to get to the bottom of why this is
happeneing.

I can capture the error in the Error event of the winsock control, but there
are other threads which are running, such as form timer events, and the
procedure that tried to connect with the winsock in the 1st place. What I
would like to do is terminate all code running from my error event, reset
any variables etc. just as if I had clicked the Reset/Stop button in the vb
editor window.

Does anyone know if it is possible to do this?

Many thanks,
Jim
 
S

Stuart McCall

Jim Franklin said:
Hi,

Can anyone tell me if there is a way of terminating ALL vba code which is
running in an Access 2003 application?

I have an form which contains a Winsock control to communicate with a
remote device on the network. Periodically I am getting a Winsock Error
"10054: the connection is reset by server side." after which I cannot
communicate with the remote device. I am trying to get to the bottom of
why this is happeneing.

I can capture the error in the Error event of the winsock control, but
there are other threads which are running, such as form timer events, and
the procedure that tried to connect with the winsock in the 1st place.
What I would like to do is terminate all code running from my error event,
reset any variables etc. just as if I had clicked the Reset/Stop button in
the vb editor window.

Does anyone know if it is possible to do this?

Many thanks,
Jim

Seems a bit drastic, but yes it's doable. Just include the line:

End
 
J

Jim Franklin

Thanks Stuart. Sounds silly but i never realised you could do that!

It probably is drastic, but until I can find the reason for the Winsock
errors at least it will do for now.

Thanks again,
Jim
 

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