Some Code is Periodically Skipped

M

Michael

I have an Access database that will on occasion ignore some of the VBA
code for various objects.

For example, I have a form which has code in the Form_Current event.
After a period of time, the code in the Form_Current sub will stop
being executed. There is no error reported by Access and there is no
error logged that I can find in the Event Viewer.

In order to "correct" the issue, I cut the code from the Form_Current
sub, save the form, and paste the code back into the Form_Current
sub. The code will then be executed again. The code is not changed,
I simply cut, save, and paste.

Using "/decompile" and then recompiling the code does not correct the
issue; it must be cut and pasted.

I have experienced this intermittently for some time now but twice now
in the past week. Once the issue happens for a given event, that
event will fail to execute the code until it is cut and pasted.
However, it isn't always the same event, nor is it the same object.
Sometimes it is the form current event sometimes it is a command
button click event; it varies. It also varies from object to object
happening on different forms.

I'm at a loss as to what causes the issue. Does anyone have any
recommendations on other things to check?

Thanks in advance,
Michael
 
N

Neil

I have occasionally run across that, usually when I'm developing new code.
I've never experienced it after the code's been in place for a while. I've
found that executing the code with a code stop (F9) in place corrects the
problem, as well as making a modification to the code. Don't know what
causes it. But it seems (to me) to only happen when code is new. I'm guess
something got skipped in compiling for some reason.

Is this an MDB or ACCDB? Might try creating a compiled version (MDE or
ACCDE) and see what happens. Theoretically, that has all code compiled, and
nothing changes. So, theoretically, nothing should be skipped.

Seems that when you're making changes your compiler is not compiling
everything. Unless you're saying that it's happening to a database file that
hasn't been modified (except for data, of course) -- in which case that
would be strange.

While I'm loathe to recommend it (because it's such a pain, and I hate it
when people recommend it to me), you might want to try uninstalling and
reinstalling Access. Or, if it's only happening with this database file,
perhaps create a new blank db and import all the objects in?

Sorry I couldn't be more helpful!

Neil
 

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