There doesn't seem to be a great deal more to say about AutoExec macros, does there? Well, I will point out that there is a faster alternative if (and only if) you also load a start-up form. If it is suitable to do so, consider putting a VBA equivalent to the AutoExec macro in the OnLoad event of your start-up form. This will speed up your's database load time if the form already has a module (i.e. there is already some VBA on the form). This is because Access only has to load the form and its module into memory, rather than the AutoExec macro, the form and its macro. Okay, so it might only save half a second but, as I have mentioned elsewhere, performance is key to me; as Paul Daniels used to say, every second counts!
DISCLAIMER: the content of this site was originally written between 1997 and 2003, when I was an Access developer by trade (and a pretty good one too, I hope). It used to be on its own website, Accessory, until the host pulled their free packages and I couldn't make it pay. Some of these tips, tricks, techniques and tools will be old hat now, or only apply to old versions, but some may still be useful, hence I'm making it all available. But caveat emptor, basically.
Friday, 9 October 2015
When to use an AutoExec macro
An AutoExec macro is a smart way of running a series of actions every time your database is started. Unless you bypass the start-up (by holding down the shift key), this macro will always be run when the database loads. If you want to perform actions not supported in macros, simply write them as a function in a module and use RunCode from within the AutoExec macro to call them. Also if, for reasons best known to yourself, you don't want to call your start-up macro 'AutoExec', call it something else and then use the /x command line parameter to reference it.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment