Solved

Why does my Access VBA code not stop at breakpoint

Posted on 2016-09-01
5
39 Views
Last Modified: 2016-09-01
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.
Demo debugger does not stop.
0
Comment
Question by:Fritz Paul
5 Comments
 
LVL 84
Comment Utility
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.
0
 
LVL 49

Expert Comment

by:Gustav Brock
Comment Utility
If the form has no records, the OnCurrent event will not fire.

/gustav
0
 
LVL 57

Expert Comment

by:Jim Dettman (Microsoft MVP/ EE MVE)
Comment Utility
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.
0
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
Comment Utility
BTW, in later versions, the database options "Allow Access Special Keys" also turns off break points.

Jim.
0
 

Author Closing Comment

by:Fritz Paul
Comment Utility
Thanks, that worked. You guys are great!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now