Practical Examples: Applying Advanced Techniques to Your Application
![]() | Many examples in this chapter can be used in all the applications that you build. To polish your application, build a startup form that displays a splash screen and then performs some setup functions. The CHAP9EX.MDB file contains these examples. |
Getting Things Going with a Startup Form
The frmSwitchboard form is responsible both for displaying the splash screen, and for performing the necessary setup code. The code in the Load event of the frmSwitchboard form looks like this:Private Sub Form_Load()
DoCmd.Hourglass True
DoCmd.OpenForm "frmSplash"
Call GetCompanyInfo
DoCmd.Hourglass False
End Sub
The Form_Load event first invokes an hourglass. It then opens the frmSplash form. Next, it calls the GetCompanyInfo routine to fill in the CompanyInfo type structure that is eventually used throughout the application. (Type structures are covered in Chapter 12, "Advanced VBA Techniques.") Finally, Form_Load turns off the hourglass.
Building a Splash Screen
The splash screen, shown in Figure 9.39, is called frmSplash. Its timer interval is set to 3,000 milliseconds (3 seconds), and its Timer event looks like this:Private Sub Form_Timer()
DoCmd.Close acForm, Me.Name
End Sub
Figure 9.39. Using an existing form as a splash screen.

The Timer event unloads the form. The frmSplash Pop-up property is set to Yes, and its border is set to None. Record selectors and navigation buttons have been removed.