Another error in the code. The first cnt loop has a limit of 99. It should be 499. I made the array large because I suspected that there may be recursive calls and I wanted to see how deep the recursion went.
You mean I missed a bug? Boy, is my face red! :)
In my defense, I didn't actually read the code. Just glanced at the comments.
I actually ran into this error for the first time when I was trying to close a form while a class module function was changing the page on a tab control. Solved it by simply saving a boolean that it should close and check for it's value after the tabpage change function took place. Perhaps someone who didnt think of this obvious solution like me in the first place may find use of this tip.
We often have members, and other public users, who go through threads looking for answers. This includes many threads that haven't been actively updated for years, but that doesn't mean they're not still in use.
I had a very similar problem to the one in the original post, and Killer42's suggestion above was very helpful. I stepped through my VBA code (MS Access 2007) to find the buggy code I needed to delete and that was causing the close action to fail. Thank you so much! This bug had been sitting in my code for years. I had previously put a band-aid on it until this morning when a user told me the application was crashing when they tried to open it.
Comment