- Understanding Access's Approach to Application Design
- Creating an Access Application from a Template File
- Touring the Contact Management Application
- Using the Switchboard Manager
- Exploring Form Design View and VBA Class Modules
- Downloading Templates from the Microsoft Office Update Site
- Saving a Form As a Data Access Page
- In the Real World--Putting What You've Learned in Perspective
Creating an Access Application from a Template File
When you launch Access 2002, the new Office 2002 task pane appears at the right of the main window with the default New File page active. The New File page offers you the following options:
Opening an existing database, such as Northwind.mdb, the Northwind Traders sample database that's located in \Program Files\Microsoft Office\Office10\Samples.
Opening a new (blank) database.
Creating a copy of a database from an existing Access file.
Using the Database Wizard to generate a new database from one of the 10 database templates included with Access 2002. Template files contain the definitions of Table, Form, and Report objects, plus the VBA code required to automate interaction of these objects.
To use the Database Wizard to create a sample application from an Access 2002 template, follow these steps:
-
Choose Programs, Microsoft Access from the Start menu to launch Access 2002 with the New File task pane visible. If you don't see the New File task pane, choose View, Toolbars, Task Pane to display it.
-
Click the General Templates link of the New from Template group (see Figure 3.1) to open the Templates dialog.
-
Click the Databases tab, and select one of the 10 database templates (*.mdz files) to build your new application from (see Figure 3.2). Access stores its templates in the \Program Files\Microsoft Office\Templates\1033 folder. This example uses the Contact Management.mdz template. Click OK to open the File New Database dialog.
-
The wizard proposes a default database with the name of the template plus a 1 suffix. The default location of the database file is your My Documents folder. Accept the default name or shorten it to Contacts.mdb (see Figure 3.3). Click Create to generate an empty Jet 4.0 database file (Contacts.mdb) and start the Database Wizard.
-
The first dialog of the Database Wizard describes the type of information that the new database stores (see Figure 3.4). Click Next to continue.
-
The second Wizard dialog lets you add or remove optional fields to each of the three tables. Optional fields appear in italic type in the list. To add or remove an optional field of the Contact Information table, mark or clear the check box (see Figure 3.5). Check the Home Phone field and click Next to continue.
Figure 3.1 Double-clicking the General Templates link under the New from Template heading of the task pane opens the Templates dialog with the Databases page active.
Figure 3.2 Select the Contact Management template in the Databases page of the Templates dialog.
Figure 3.3 Shorten the default database file name, Contact Management1.mdb to Contacts.mdb.
Figure 3.4 The first Database Wizard dialog offers a brief description of the new database.
Figure 3.5 Add the optional Home Phone field of the Contact Information table of Contacts.mdb.
NOTE
You can remove only the optional fields you add. You can't remove the standard set of fields that appear in Roman type; you receive an error message if you try.
-
The third Wizard dialog offers a selection of text colors and background colors or images for the data forms that the wizard creates. As you select an item in the list, a sample of the style appears in the dialog (see Figure 3.6). Select a form style and click Next to continue.
Figure 3.6 Select the text color and background color or image for data-entry forms.
-
The fourth dialog lets you choose a style for printed reports (see Figure 3.7). Pick a report style, such as the conservative Soft Gray, and click Next to continue.
Figure 3.7 Select the header and type styles for reports in the fourth wizard dialog.
-
You enter the title to appear on your forms and reports in the fifth Wizard dialog (see Figure 3.8). The default title is the name of the template file. Accept or edit the title.
-
If you have a bitmap (.bmp or .dib, device-independent bitmap) or vector (.wmf, Windows metafile, or .emf, enhanced metafile) image of a logo that's of a size suited to the header of your reports, mark the Yes, I'd Like to Include a Picture check box. (The logo should be about 80x80 pixels or less.) Click the Picture button to open the Insert Picture dialog. Select the image file and then click OK to insert the image and close the Insert Picture dialog.
Figure 3.8 Accept the default title to appear on forms and reports.
-
Click Next to open the final Wizard dialog (see Figure 3.9). With the Yes, Start the Database check box marked, click Finish to add the objects whose properties you've specified to the database file you named in step 4.
Figure 3.9 Click Finish in the final Database Wizard dialog to start generation of the Contacts.mdb database.
A set of progress bars displays the Wizard's actions. The time required to complete the generation of database objects depends on your CPU's and disk drive's speed; it takes less than 10 seconds to finish the Contact Management database with a 667MHz Pentium III PC and a high-speed fixed-disk drive. After the Wizard completes its work, the Main Switchboard form for the completed Contact Management application appears, as shown in Figure 3.10. The Database window, which lets you manually open any of the objects in the Contacts database, is minimized at the bottom left of the display.
Figure 3.10 When the Database Wizard completes its task, the Main Switchboard form opens.