I’m back to a variation of the problem that was discussed at https://www.accessforums.net/showthr...094#post507094
After lots of testing of Allen Browne’s method and reviewing Juan Soto’s video, (and spending lots of time in other Google searched solutions), I’m wondering how to manage multiple instance forms to work when closing. Someone may have mentioned that the debugger gets confused with multiple instances of a form running, and I can confirm that that is a gross understatement.
Not only does the debugger get confused, but the closing of one instance seemingly corrupts the variables in another instance. Yes, they share the same VBA code, but either Microsoft forgot to create a separate code instance or there is a bug that allows one instance to corrupt another.
I have a demo, and I’ve tried to close all the open forms using the Allen Browne approach:
which seems, as best as I can tell from my testing, to bypass all the VBA code for the form i.e. that might handle errors when closing.Code:colOpenForm.Remove 1
So, I tried a different approach with a timer and tempvars to force a close of the forms. At least I can get the forms to close and run some procedures, but I suspect the corruption of an open form’s variables by another form that closed plays havoc with the form closing VBA logic.
Here are the instances of the form:
Then, after pressing F8 on the first stop in the force close procedure, all the forms have their message box pop up (not individually, not each with their own stop—debugger problem) as shown here:
Not only that, the second stop and the breakpoint (shown in blue highlight) are blown past and the forms start to close, but the final form can’t close because it’s variables have been corrupted as shown with the highlight of orange in the immediate window (the print was run twice, the blank line shows the variable Valdt(0,1) has been cleared.
There is nothing in the code that cleared Valdt(0,1). Reset wasn't done while debugging.
I’m in Access 2021, 64 bit on Windows 10.
Can anyone confirm this problem/possible bug, or suggest what I may be doing wrong when closing multiple instances of a form?