Q:

ms-access: doing something on database open

is it possible to run a sub or function as soon as the user opens an access database file? if so, how?

A:

Create your function:
Public Function DoSomething()
    ' do stuff '
End Function

Then create a macro with the run code action which calls your DoSomething function.  Name the macro autoexec.  Then, every time the data base starts up, it will run your autoexec macro.
Another thing you can do is set a form to open whenever the database starts.  You could then call your DoSomething function from a form event (on open, or on load).
Choose one of those approaches.  Either way, if you ever want to start the database without DoSomething running, hold down the shift key as the database opens to bypass your automatic startup routine.

