Solved

Why does my Access VBA code not stop at breakpoint

Posted on 2016-09-01
5
50 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
ID: 41779615
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
ID: 41779622
If the form has no records, the OnCurrent event will not fire.

/gustav
0
 
LVL 57
ID: 41779630
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
ID: 41779634
BTW, in later versions, the database options "Allow Access Special Keys" also turns off break points.

Jim.
0
 

Author Closing Comment

by:Fritz Paul
ID: 41779672
Thanks, that worked. You guys are great!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

863 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

27 Experts available now in Live!

Get 1:1 Help Now