Auto Executing module

  • Thread starter Thread starter Peter Marshall
  • Start date Start date
P

Peter Marshall

How do I get a vba module to execute as soon as my Access 2002 application
is loaded (even before the Switchboard loads)?
 
I just tested and the startup form's Open event fires before the Autoexec
macro, if you have one. So, the form appears to be the first thing to run.
If you want it to run before the switchboard, you may be able to open
another form, place code in it, and open the switchboard from that form.
However, if you are trying to run something that will allow you to cancel
the opening of the switchboard, you may be able to do it in the
switchboard's Open event and use the Cancel ability built-in there. I tried
setting Cancel = True in my startup form's Open event, the form never showed
on the screen and I received no errors.
 
Thanks, Wayne. Calling my module from the Open event of my main switchboard
works fine. I was just concerned that the module would execute everytime
the main menu appears, but it is really only opened when the app loads (it
is minimized during other times).
 
Alex, I like your solution too. I had tried to write a macro to execute a
function but the function wasn't listed. Then I found that I had originally
declared it as Private not Public. Also I wasn't sure what the name of the
macro had to be. All is well now. Thanks guys for your expert help!
 
Back
Top