I've gathered from reading posts here that a common practice to facilitate running code at Database Close is to open a hidden form that contains Event code for the OnUnload Event, when you Open the Database. By allowing this form to remain open as long as the DB is open, it will then be closed when the DB is closed, triggering its Unload event.
As for how to launch this Hidden From upon database open, I've come up with a couple of methods and am seeking advice on which approach is most advisable, and if there are others I"m missing. Just trying to learn.
1) Create and AutoExec Macro - open the form in that macro, or have macro refer to VBA procedure that would do the same.
2) In Access 2007+ when using a Custom Ribbon - Use the CustomUI Ribbon's OnLoad procedure to load this hidden form.
This approach of using a hidden form seems similar to using a class module that would trap Application level Events in other Office applications. Access doesn't seem to expose Application Level Events in the same way, so you use the Form (class) to do it for you?
Am I getting this right?
Thanks for the advice,
Shred
As for how to launch this Hidden From upon database open, I've come up with a couple of methods and am seeking advice on which approach is most advisable, and if there are others I"m missing. Just trying to learn.
1) Create and AutoExec Macro - open the form in that macro, or have macro refer to VBA procedure that would do the same.
2) In Access 2007+ when using a Custom Ribbon - Use the CustomUI Ribbon's OnLoad procedure to load this hidden form.
This approach of using a hidden form seems similar to using a class module that would trap Application level Events in other Office applications. Access doesn't seem to expose Application Level Events in the same way, so you use the Form (class) to do it for you?
Am I getting this right?
Thanks for the advice,
Shred