Stop code on error

O

OssieMac

Using Access 2002.

I have a problem of not being able to stop a program when a specific error
occurs. (Not all errors; most I can handle). It goes into an eternal loop and
cannot be stopped. Ctrl/Break stops it but it starts again irrespective of
whether End is selected or Debug is selected followed by End in the VBA
editor. I have even tried placing End in the program immediately after the
Msgbox that advises the user of an error. (All errors are handled by an error
routine that gathers information and writes it to a text file plus a msgbox
to the user.)

Is there any code that I can use that will guarantee that the program stops
instead of going into an eternal loop? Currently Ctrl/Alt/Delete and stop it
with Windows Task Manager is the only way to stop it.

I'll provide the following information about the specific error in case it
is helpful.

With the users filtering data on a form using the built in toolbar buttons;
Filter by form and Apply filter.

When entering a filter parameter in a combo box, the same rowsource
filtering restrictions apply as if the user is entering data.

I have a lookup table with an additional field of True/False that gets set
to true (using sql code in AfterUpdate event) when a number is used and
therefore in future that number does not display because the field is set to
True (Used) in the Lookup Rowsource query build. However, when using the form
filter, the user wants to be able to find the used ones rather than the
unused.

If the user enters a number directly without selecting from the drop down
(because they cannot see it in the dropdown), they get the usual system
generated message that it is invalid. However, if while the cursor is still
in the field, they click on Apply filter, that is when the system goes into
an eternal loop continually displaying the message box.

I have handled the combo box thing in the On filter event by creating 2
queries and toggle the query for the Row source to allow True when in filter
mode and toggle it back to the original query with Apply filter event (when
it is ApplyType2) and it is working well. However, I would like an answer to
my original question if there is one because this might not be the only
situation where the program will go into an eternal loop and I would like to
be able to handle such a situation.

All help is greatly appreciated.
 

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