VBA code stops running without error

JamesN

Registered User.
Local time
Today, 10:46
Joined
Jul 8, 2016
Messages
78
Hi,

I have an access front end database with the tables connected to sharepoint lists. Witihn the database is a main form which is used to score various metrics, if required the user is then prompted to open several other separate forms to select some further details. Data is taken from various forms and submitted into a main table.

99.9% of the time users are able to submit records without any issue, however, I am finding though that certain users are encountering an occasional error whereby the VBA code starts running and randomly stops without any error popping up. When the error occurs it is always the same point. The first bit of code opens all of the forms and checks all relevant boxes have been scored. The part where the code drops out is as soon as all forms are open, but the remaining code is not executed.

How can I pin-point the error?

Thanks in advance
 
This is not an 'error' , it is a bug in Access. It thinks there is a breakpoint in the code when there is not.
I too get this on certain PCs.
There's no bug in the code.
Even if you compact /repair is does not get rid of the problem. Access is the problem, not the db.

now, If i misunderstood and your code DOES stop on an error, then
you need to put in error handling.

Code:
sub MySub()
on error goto ErrCatch
'code
'code'
exit sub
ErrCatch:
msgbox err.Description,, err
end sub
 
Thanks Ranman, it definitely sounds like it is the bug you have mentioned as there are no errors appearing. Is there any way around this?
 
Hmm. I'm not convinced this is an Access bug.
Are you using an ACCDE or MDE file.
If so, unhandled errors will cause the program to crash.

If its an ACCDB or MDB file, add error handling code to all your procedures and locate the error(s).
If using ACCDE/MDE, you'll need to do this in the original file then remake the ACCDE.

Also try fixing any corruption
A) decompile, recompile, compact.
B) check the MsysObjects table
C) try increasing the max locks per file entry in the registry as you say this happens when lots of items are open at the same time
 
It is an ACCDE file. I've got lots of error handling in place but struggling to locate the error, the code runs but on the odd time it just stops but no error pops up so unable to debug. On one instance it kept dropping out of the code but when the user closed the form and re-opened it the code ran fine.

I will attempt the steps mentioned below and see if that fixes it
 
Bug or not, I've experienced the same problem at times, in both mdb and accdb files, where running just breaks on a line of code, always I think where a breakpoint had been set and subsequently removed.

I fixed it by deleting and reinserting the line (control-Y Control-V).

I now normally put a hard stop followed by a 'xxx (comment). Makes it easy to find when tidying up.
 
As the song goes "A long, long time ago, I can still remember when" I had an issue as you describe involving an unreliable network connection causing the program to lock up when initially accessing files.

Found out because I put a little field in the upper right corner and updated it with everything I was doing on program start up, line by line. Finally I just had to wait for it to happen and ask for a screen shot. IIRC it was an issue with an ODBC driver.
 

Users who are viewing this thread

Back
Top Bottom