Creating an Access Application from a Template File

graphics/new.gif

When you launch Access 2003, the upgraded Office 2003 task pane appears at the right of the main window with the default Getting Started page active. The Create a New File link at the bottom of this page opens the New File page, which offers you the following options:

  • Opening a new (blank) database or data access page (DAP).

  • Creating a new Access data project (ADP) connected to an existing or new Microsoft SQL Server Desktop Engine (MSDE) database.

  • Creating a copy of a database from an existing Access file.

  • Searching for an Access template by keyword or opening the Microsoft Office Templates home page to select a specific template.

  • Using the Database Wizard to generate a new database from one of the 10 database templates included with Access 2003. 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 2003 template, follow these steps:

  1. graphics/task_pane.gif Choose Programs, Microsoft Office, Microsoft Office Access 2003 from the Start menu to launch Access 2003 with the Getting Started task pane visible. If you don't see the task pane, press Ctrl+F1 or choose View, Toolbars, Task Pane to display it.

  2. Click the Create a New File link or click the arrow to the right of Getting Started, and choose New File from the drop-down list.

  3. Click the On My Computer link of the Templates group (see Figure 2.1) to open the Templates dialog.

    Figure 2.1. Clicking the On My Computer link under the Other Templates heading of the task pane's New File page opens the Templates dialog with the Databases page active.

    graphics/02fig01.jpg

  4. Click the Databases tab, if necessary, and select one of the 10 database templates (*.mdz files) to build your new application from (see Figure 2.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.

    Figure 2.2. Select the Contact Management template in the Databases page of the Templates dialog.

    graphics/02fig02.jpg

  5. 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 filename or shorten it to Contacts.mdb (see Figure 2.3). Click Create to generate an empty Jet 4.0 database file (Contacts.mdb) and start the Database Wizard.

    Figure 2.3. Shorten the default database filename, Contact Management1.mdb to Contacts.mdb.

    graphics/02fig03.gif

  6. The first dialog of the Database Wizard describes the type of information that the new database stores (see Figure 2.4). Click Next to continue.

    Figure 2.4. The first Database Wizard dialog offers a brief description of the new database.

    graphics/02fig04.gif

  7. 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 2.5). Mark the Home Phone field and click Next to continue.

    Figure 2.5. Add the optional Home Phone field of the Contact Information table of Contacts.mdb.

    graphics/02fig05.gif

    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.

  8. 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 2.6). Select a form style and click Next to continue.

    Figure 2.6. Select the text color and background color or image for data-entry forms.

    graphics/02fig06.gif

  9. The fourth dialog lets you choose a style for printed reports (see Figure 2.7). Pick a report style, such as the conservative Soft Gray and click Next to continue.

    Figure 2.7. Select the header and type styles for reports in the fourth Wizard dialog.

    graphics/02fig07.gif

  10. You enter the title to appear on your forms and reports in the fifth Wizard dialog (see Figure 2.8). The default title is the name of the template file. Accept or edit the title.

    Figure 2.8. Accept the default title to appear on forms and reports.

    graphics/02fig08.gif

    Note

    If you have an image of a logo that's of a size suited to the header of your reports and is in one of the 16 graphics file formats supported by Office 2003, mark the Yes, I'd Like to Include a Picture check box. (The logo should be about 80 x 80 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.

  11. Click Next to open the final Wizard dialog (see Figure 2.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 2.9. Click Finish in the final Database Wizard dialog to start generation of the Contacts.mdb database.

    graphics/02fig09.gif

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 2.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 2.10. When the Database Wizard completes its task, the Main Switchboard form opens.

graphics/02fig10.jpg



Special Edition Using Microsoft Office Access 2003
Special Edition Using Microsoft Office Access 2003
ISBN: 0789729520
EAN: 2147483647
Year: 2005
Pages: 417

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net