Base Form Events Call the wrong macros

I’ve got an .odb that several of my forms have built-in events that start macros. Now, the macros are all sorted into dedicated modules for the forms that start them. The other day, I started adding macros to one form, and now today, I find that another form is calling macros in that form’s module instead of the correct macros. Has anyone seen anything like this before? BTW, I’m using 5.3.7.2.
I tried editing the offending form and re-selecting the macros that events are supposed to call, and saving it, and whenever I open it, I get the attached error message.


Metrology.odb (256.4 KB)
Edit: I’ve gone ahead and uploaded the .odb file, which I should have done in the first place. The offending form is “Equipment Maintenance Log”.

Is it possible I’ve exceeded some sort of storage limit for my macros contained in the .odb file?

I just found this bug report:
FILEOPEN Can’t open particular base form

That thread seems to suggest that the problem is that the offending form was previously edited in LO 7, and now I’m using an older version. I just wish I could remember exactly why I rolled back, so I could determine what I’m going to break if I reinstall 7. I know when I rolled it back I posted that I did. Is there a good way to search this forum for a post by me with the word “rolled”?Nevermind. It was easy. I’m embarassed I even asked.

So I went ahead and reinstalled LO7. I re-selected the correct macros in the events, and now I’m able to open the forms for use without getting that error message. But unfortunately, the same wrong macros are still called. Anyone have any thoughts on this?

I should have done this from the start: I uploaded the .odb file to the original post in this thread.

It looks for me like the form document has been saved in ODF 1.3 and you want to open it with ODF 1.2. This has been changed with LO 7.0.

The database you connect to is a MySQL database. So other people can’t try to search for the right or wrong macro.

@RobertG
Right. I went ahead and reinstalled 7.0.2, and the form is still running the wrong macros.

Yes, it is. Even though the macros interact with the database, which one is run is tied to the form the user is using.

To aid in determining what’s going wrong, I’m uploading a copy of the .odb file where I added a msgbox to the macro that’s errantly being run. The msgbox explains the only circumstances where it should be run. Whenever the date column in “Equipment Maintenance” loses focus, there’s a macro SelectPartOfDate in the Equipmaint_Module that should be run. And whenever the Personnel column gains focus, there’s a macro Equipmaint_Autofill Personnel that should be run. In both cases, the macro AddResults_Close is run, which is only meant to run when the Add Results" form is closed.
Metrology, Troubleshooting.odb (256.5 KB)

But of course, you’re right. Base probably won’t allow anyone to open any of these forms if they can’t connect to the underlying MySQL database. I might just have to noodle around a bit with recreating the modules copying and pasting contents and re-pointing the events to the correct macros. I probably created some sort of glitch by using different LO versions in a weird order in the evolution of this .odb file

I got it sorted. I copied the contents of the module containing the macros that were supposed to be running and the one containing the macro that was running instead into their own text files and deleted those modules. Then, I tried to use the form. Whenever it hit an event that called a macro, I got an error message to the effect the macro could not be found. Then, I re-created those two modules using their original contents. Lo and behold, things started working as intended. I still have no idea why this happened in the first place.

It did it again this morning. I’ve now concluded that my assumption that it’s running the wrong macro was incorrect. The reason I thought it was was because it kept raising syntax errrors in that macro. So, my takeaway is that if I’m going to make changes to macros to a working database, I need to make sure that every time I use that .odb, all the modules compile correctly. I assume the way it works is that before it runs a macro, it compiles that library.