Create your function:
Public Function DoSomething() ' do stuff ' End Function
Then create a macro with the action of a startup code that calls your DoSomething function. Name the macro autoexec. Then, every time the database starts up, it runs your autoexec macro.
Another thing you can do is set up a form to open when the database starts. Then you can call the DoSomething function from the form event (when opening or loading).
Choose one of these approaches. In any case, if you ever want to start the database without starting DoSomething, hold down the shift key when the database opens to bypass your automatic startup procedure.
Hansup
source share