Link to home
Start Free TrialLog in
Avatar of Fritz Paul
Fritz PaulFlag for South Africa

asked on

Why does my Access VBA code not stop at breakpoint

My Access VBA code does not stop at breakpoints. How can I fix that please?
I have set breakpoints and "STOP's", but the code just runs past them. See my code below. I do get the message, but the code does not stop.
User generated image
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

If breakpoints are not working, then often you have troubles with your database. Make a backup, then do this:

1. Compact the application
2. Compile the application. From the VBA Editor window click Debug - Compile. Fix any errors, and continue doing this until the Compile menuitem is disabled.
3. Compact again

You may also need to decompile. To do that, create a shortcut with this as the Target:

"full path to msaccess.exe" /decompile

Run that shortcut, and select your database when Access opens. Access will decompile your code and leave your database open. After your database is open, run the 3 steps above again.

You may also have container corruption. If so, often the only fix is to create a new, blank database and import everything from the old database into the new one. If you have a corrupt object, however, this may not work, as Access will choke on the import of the corrupt object. If that occurs, then you must import each object individually, and recreate the corrupt object from a recent backup, or from scratch.

Finally, be sure that your Office and Windows installations are fully up to date.
If the form has no records, the OnCurrent event will not fire.

/gustav
In the VBA editor, click tools, options.

On the general tab, make sure your set for "Break on Unhandled Errors".

/Decompile is what will probably straighten it out though.

Jim.
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Fritz Paul

ASKER

Thanks, that worked. You guys are great!