SOLVED

Phantom Breakpoints in MS Access VBA

Copper Contributor

I've been using Access for better than 20 years at this point.  Only in the last few versions have I noticed this problem of "Phantom breakpoints."  This is where you'll be working on a module, or piece of VBA code behind a button, form, label, or other object, and you click the breakpoint little maroon circle out to the left of your code, and when you run the code it stops at that breakpoint.  It works great! 

The problem comes however when you try to un-check the maroon breakpoint - either by clicking it and it goes away, or by using the menu option "clear all breakpoints" - and then most of time time breakpoint will cease to stop the flow of the code.  Unfortunately it doesn't always go away.  Maybe 2 out of 10 times it will not really clear the breakpoint, and typically I don't find out about it until it's been distributed to the clients and I get a call that "Your application has stopped on that stupid yellow code thing again!"  If it only happened 1 out of 100 times, that would be something I could live with, but 20% of the time is move than I can bear.  Can someone people tell me of a cure for this problem?  Is it something Microsoft is aware of? 

 

Microsoft makes changes to the interface that involve the look of buttons, or the alternate row color setting on reports, which are nice I guess - I prefer the plain jane look of forms and reports, however You would think they would fix this bug before devoting time to making more "flash" for the interface.

-Breakpointed in Tampa

 

14 Replies

Yes, this is a known issue and had been brought to their attention in the past. There are numerous issues with each newer version of Access, just one more reason to stay with the tried, tested and true older versions!!

 

Feel free to send Microsoft your comments through the Feedback command in Access and also through access.uservoice.com

best response confirmed by isladogs (MVP)
Solution

@BrianDP222 

Although it would be nice if Microsoft found time to correct this, the likelihood of that happening in the context of far more serious, work-stop type bugs, it's not likely to be addressed very soon.

 

That said, I think you can more or less reliably avoid this problem by making a preventative step one of the things you do just before distributing a new version of an accdb Front End to users.

 

This "phantom" seems to happen when you've been editing and saving VBA during a session, adding and removing break points. What can happen is that you do end up leaving behind one of those phantoms.

The remedial step I've adopted, based on experience and results shared by others, is that you simply insert and remove one blank line in a module. Then immediately Debug-->Compile your VBA. Then immediately Save it.

Run a Compact & Repair on the accdb. Test in run mode WITHOUT stopping the code anywhere. If the phantom break point does raise its ugly head again, go to the specific procedure and repeat the steps outlined above. At some point, you'll have eliminated them all.

 

Not as simple, I guess, as being able to count on some automatic process might be, it is effective.

Usually after a significant update, a customer emails a screen shot of the yellow highlighted code and asks "What do I do now". This problem is very random. But my solution has been to simply comment out the offending line of code, insert a blank line, and retype the exact same code on the new line. The phantom breakpoint is essentially disabled by the comment mark. Feel free to use my solution without any attributions to my genius intellect. :)

C&R also clears the issue for me, and you should always run this as one of the last steps before publishing a revision.

If C&R shouldn't work for you, a decompile will. Make a backup and then run:

 

    MSACCESS.EXE yourdb.accdb /decompile

 

Then call C&R, close Access, relaunch the application, call Compile, and save the modules.

@this_is_silly  Yeah, how annoying. I usually cut the offending sub/function, delete a blank line and paste it back in. Same result. I've only seen this recently in Office 365 apps. Maybe in the next release, they'll introduce some new bugs/features and fix a few of the existing ones.

I normally do the same steps & in the same order.
1. Make a small change, delete & save
2. C&R
3. Decompile
I normally step 1 is sufficient.

It appears that this can happen when a breakpoint is put somewhere in the code then the VBE is closed without removing the breakpoint followed by closing Access.
When Access is reopened, there is often a phantom breakpoint where it was left in place previously.

I try to always ensure breakpoints are cleared before closing Access so rarely have the problem myself. However the Access team are aware of & looking into this elusive bug

 

@Michael_Brodsky 
If you look at the monthly bug fix reports, you'll see that the Access team are working hard to clear the backlog of bugs. They prioritise those having most impact, especially where the bug can be replicated

Phantom break points happen to me occasionally. My solution is to comment out the offending line with an apostrophe and then just copy and paste that code to a new line. Apparently this sets the break point on a commented out line and is ignored. I tried some of the other solutions here, but commenting out the line solved the problem for me.
Thanks to the tenacity of Geoff Griffith, we now have a reproducible scenario, and MSFT has promised to look at it. Mind you, that is not a promise to fix it.
Interestingly, Geoff reported what I always thought was the problem. However, whenever I tried to pin it down, it wasn't replicable. I repeated the tests using Geoff's description and the phantom breakpoint refused to show up. I think this will be very tricky for MS to solve reliably.

@MendipDataSystems  Phantom Breaks are not the worst I've seen with the newer version of Access.  What I cannot stand is when you have a window open with your form on it that you're designing, and you also have a window open with Code on it.  If you make a mistake, and float your mouse over the Code window, it instantly selects that underlying window - even if you didn't click in that code window.  VERY (*%&@ annoying.  I cannot tell how you angry this makes me.  

@BrianDP   Yes!  That is super annoying but I discovered what causes that and now use it as a "feature".   When your pointer passes over the VBA Code window, if your pointer passes over the "General" or "Declarations" drop downs at the top of the window, then the VBA code window is immediately activated.  Now that I know that, I avoid doing that, unless I want to switch windows.

Things should not activate unless you click them. I believe you're the first person I've discussed this with who knew what I was talking about.

WHY would it just decide to activate itself??! It's never done that in the LAST 20 years I've been using this product! Now I've been using my editor with the code window FAR away to the left side of the screen. It's like Microsoft just changing things for no reason at all. It makes you want to never get an update! They've ruined the printer part of the control panel, when you look at items in the print queue, they're so HUGE I can only see a couple of documents at a time.
This is a known issue and the Access team have already been made aware of issues caused by this behaviour. However, it also occurs in other Office apps such as Excel which means it needs to be dealt with by the VBA or Office team

You are most likely to experience the issue you have the VBE and Access windows on the same monitor with the VBE partly hidden behind the main Access window
It is easily avoided by not having the two windows overlapping ...or use as a 'feature'

I rarely experience it as I use two monitors and place the VBE on the secondary monitor
Nothing against the team working on this, I'm sure they must have more important things to work on because it's been what? 2 years or more that this has been a fairly significant problem. I too use two monitors, and I guess it's just me, but I sort of have internal conversations with myself when I'm programming, and I "speak with my mouse" like some people speak with their hands. So, I find it stifling to try to NOT be moving the mouse to and fro when I'm trying to be creative in the development mindset. Anyway, if they ever do fix it I'll be grateful. As it is, I've learned to live with it.
1 best response

Accepted Solutions
best response confirmed by isladogs (MVP)
Solution

@BrianDP222 

Although it would be nice if Microsoft found time to correct this, the likelihood of that happening in the context of far more serious, work-stop type bugs, it's not likely to be addressed very soon.

 

That said, I think you can more or less reliably avoid this problem by making a preventative step one of the things you do just before distributing a new version of an accdb Front End to users.

 

This "phantom" seems to happen when you've been editing and saving VBA during a session, adding and removing break points. What can happen is that you do end up leaving behind one of those phantoms.

The remedial step I've adopted, based on experience and results shared by others, is that you simply insert and remove one blank line in a module. Then immediately Debug-->Compile your VBA. Then immediately Save it.

Run a Compact & Repair on the accdb. Test in run mode WITHOUT stopping the code anywhere. If the phantom break point does raise its ugly head again, go to the specific procedure and repeat the steps outlined above. At some point, you'll have eliminated them all.

 

Not as simple, I guess, as being able to count on some automatic process might be, it is effective.

View solution in original post