As a follow on from my last post about Microsoft Access Macros, here’s a good working example clearly explained using the ‘unsafe’ CloseWindow command…
It walked you through creating a custom hotkey for Microsoft Access (using version 2010 though it will also apply through to the current version, 2016) which used the ‘Autokeys’ macro.
This macro shows you how to avoid a problem during a design and run-time for a form where incorrectly closing this object can save filters and sorts into their properties and alter their behaviour when re-visiting the form.
How to Create an Autokeys Closing Macro in Microsoft Access
Autokeys is one of two predefined macro names that will trigger itself when the application starts, the other being Autoexec. Take a look at an older but still current blog post about creating a macro that runs when you open your database.
This video tutorial uses the submacro command to allow multiple macro procedures to be grouped into one overall macro object and is stored in the public Navigation Pane area so it can be used in more than one place.
The key thing to remember is the scope – the Navigation Pane view making it public and not storing macros of this type for use privately in either a form or a report.
Therefore, a plan is suggested and grouped into one or main macros to manage the generic procedure call and of course the two Auto macros will be part of the planing too.
To gain a better handle of Microsoft Access macros, why not consider my dedicated eBook How To Use Microsoft Access Macros & Automate Your Application which comes with a money back guarantee and a 30 day email support service too.