Auto Executing module


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)?
 
Ad

Advertisements

W

Wayne Morgan

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.
 
P

Peter Marshall

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).
 
A

Alex Dybenko

then try to use autoexec macro, first run your code there, then open
switchboard
 
Ad

Advertisements

P

Peter Marshall at OCC

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top