Access has the ability to run an Access object’s VBA code automatically whenever the object (form, report, etc.) is opened. It also has the ability to automatically open a designated form when the database launches. Combining these two means VBA code within a form can be automatically run when the database opens.
1. Create a form, e.g. StartUp, that contains the organization name, logo and a main menu.
2. Add a Form_Open subroutine containing the VBA code you want to run when the database opens.
3. Test the code then save the form.
4. Make the form automatically open when the database opens:
[Click] FILE, OPTIONS
[Click] CURRENT DATABASE, then choose StartUp from the DISPLAY FORM: list.
The StartUp form will now automatically open when you next launch the database and the form’s Form_Open code will automatically run.
To circumvent automatically opening this form and running its code, hold down the SHIFT Key when launching the database.