A short but very important tip.
If you wish to run code when your database opens, then make a Macro and call it AutoExec. Anything you ask this AutoExec Macro to do will be carried out when the database opens.
For example, if you wish to check if the expiry period of a demo database has been reached, you could check it using code triggered by the AutoExec Macro (to run code, just select RunCode from the drop down list in the Action section). If the expiry date has been reached then the database would close; obviously with a message to the user that this is happening and why.