Applications use forms, along with
This chapter begins by explaining how to create an exciting first
Microsoft Access 2000 offers two types of forms: UserForms, which are also available in other Office applications, and a custom type of form that is an updated version of the form in prior Access versions. UserForms do not integrate as tightly into the Access development environment as Access forms do. For example, UserForms do not bind to Access tables and queries. In addition, the Access form wizards and control wizards do not work with UserForms. For these reasons, this chapter will deal with Access forms only. You can learn more about UserForms from the online help system.
One easy way to get started with forms is by creating a splash screen. A splash screen is a form that appears before another, more interactive form appears. Splash screens often state what an application does or who created it. You can easily control how long this form stays visible. Figure 5-1 shows a sample splash screen from the companion CD, which you can adapt to your own purposes.
Figure 5-1. A sample splash screen.
You can start by creating a tiled background. You do so by setting two form properties while the form is
Next, you can add a foreground image by choosing Picture from the Insert menu. You can also add an Image control to the form. Either method opens the Insert Picture dialog box, where you can select an image to add. Clicking OK automatically sets the image's
property. Access lets you programmatically set the
property with Microsoft Visual Basic for Applications (VBA) so you can construct the look of a form dynamically in response to user input (such as a text box entry) or environmental factors (such as a
You complete the splash screen by adding one or more Label controls. You can use VBA to set properties for the Label controls at run time. This lets you dynamically format a splash screen's text.
You can set a splash screen to open automatically by choosing Startup from the Tools menu and selecting the splash screen's form
The following pair of event procedures displays a splash screen for 10 seconds. (To get to the VBA behind a form, right-click on the form, choose Build Event from the shortcut menu, and then select Code Builder in the Choose Builder dialog box and click OK.) The
event procedure sets the form's
property value to
(10 seconds; the interval is in
Private Sub Form_Open(Cancel As Integer) Me.TimerInterval = 10000 End Sub Private Sub Form_Timer() DoCmd.Close acForm, "frmSplashTimer" End Sub