Part IV: Professional Database Development
868
To create a splash screen, create a basic form with appropriate information, such as your applica-
tion name, logo, and user registration. Next, set this form as the Display Form in the Current
Database options. You then want to call any initialization procedures from the On Open event of
the splash form. A good splash screen should automatically disappear after a few seconds.
The code necessary to close a splash screen is very simple:
Private Sub Form_Timer()
DoCmd.Close
End Sub
Set the form’s Timer property to the number of milliseconds for which you want to display the
splash screen.
Cross-Reference
For more information on splash screens and setting Current Database options (including the Display Form), see
Chapter 31.
Keep in mind the following when using splash screens:
l Minimize code in start-up forms. Use only code that is absolutely necessary to display
your start-up form and use a light form if possible.
Note
A light form is one that doesn’t contain a class module. They’re smaller and typically load and are displayed
faster than forms with class modules. Also, because they require no storage space for a class module, they can
decrease the size of your database. Possible disadvantages of using lightweight objects is that they do not
appear in the Object Browser, and you cannot use the New keyword to create a new instance of the object.
l The start-up form should call only initialization procedures. Be careful about call trees —
you don’t want your start-up form to trigger the loading of many modules in your application.
Loading and keeping forms hidden
If you have frequently-displayed forms, consider hiding them rather than closing them. To hide a
form, set its Visible property to False. When you need to display the form again, set its
Visible property back to True. Hidden forms consume memory, but they display more quickly
than forms that are loaded each time they’re viewed. In addition, if you’re morphing a form or
report (changing the way it looks by changing form and control properties), keep the form hidden
until all changes are made so that the user doesn’t have to watch the changes take place.
Using the hourglass
Use the hourglass cursor when your application performs a task that may take a long time. The
hourglass mouse pointer shows the user that the computer is busy and not locked up. Set the
Hourglass cursor like this:
DoCmd.Hourglass True ‘Use False to return to default cursor