An Access 2007 database has several ribbons, each with several buttons. Each button opens a different form.
On ribbon A: only one form should be open at a time.
On ribbon B: forms red, blue, and green may be open simultaneously but brown may only be open by itself.
What is the best way to approach this?
--------------------------------------
My current approach follows:
Add an onClose handler to every form (tedious) that calls a setApplicationStateFoo function with the name of the form.
setApplicationStateFoo cycles through all open forms, discards the most-recently-closed form from consideration, and disables/enables ribbon buttons according to the currently opened forms.
-----------------------------------------
Since I'm lazy, I would like to either:
(A) Catch and handle an event that fires when any form is closed.
or
(B) Iterate over AllForms and add the onClose event handler dynamically when the database is opened.
-----------------------------------------
Since I'm new to Access programming, I would also like to know any other (preferably better) ways to approach this problem.