If you look in the Wedding List sample database (WeddingList.accdb) included on the companion CD, you’ll find it very simple, with one main table and a few supporting tables for data such as titles, cities, and groups. Most databases are usually quite a bit more complex. For example, the Housing Reservations sample database contains six main tables, and the Conrad Systems Contacts sample database contains more than a dozen tables. If you had to create every table “by hand,” it could be quite a tedious process.
Fortunately, Access 2007 comes with table templates to help you build a few common tables. Let’s move on to a more complex task-building tables like those you find in Conrad Systems Contacts. Click the Microsoft Office Button and then click New. This returns you to the Getting Started screen, ready to define a new blank database. For this exercise, create a new blank database and give it the name Contact Tracking. We’ll use this database to start building tables like some of those you saw in Chapter 3.
To build a table using one of the table templates, close the table that Access 2007 created when you opened the database (Table1), click the Create tab on the Ribbon, and then click the Table Templates button in the Tables group. Access displays a list of five table templates-Contacts, Tasks, Issues, Events, and Assets, as shown in Figure 4–12. Microsoft uses the term Quick Create to refer to this one-click table creation feature.
Figure 4–12: The five types of table templates help you create common types of tables.
The five table templates, which represent some of the more common types of table structures found in databases, are as follows:
Contacts Use this table template when you need to track your personal or business contacts. Key fields in this template include the contact’s company, job title, and phone numbers.
Tasks Use this table template for keeping track of various tasks and projects needing completion. Key fields in this template include start and due dates for the task and percentage complete.
Issues Use this table template for recording various personal or business issues. Some key fields in this template include the title of the issue and the issue status.
Events Use this table template as a personal organizer of your appointments. This template includes fields for start and end times of the event, the event date, and even the location.
Assets Use this table template for keeping track of your assets. Key fields in this template include the acquisition date, the original price of the asset, and the current price.
|Inside Out-What Happened to the Table Wizard?|| |
The Table Wizard from previous versions of Access does not exist in Access 2007. Microsoft has replaced the Table Wizard with five table templates so that you can quickly build tables commonly found in most databases.
Click Contacts in the Table Templates list, and Access 2007 builds a complete table structure for a contacts table, as shown in Figure 4–13. Access creates a total of 18 fields to identify the data elements for this contacts table. Use the horizontal scroll bar or press Tab to see the field names to the right. This contacts table template includes fields such as Company, First Name, Last Name, E-mail Address, Job Title, and so on to identify a single subject-a contact. The Table Templates command also automatically defines a data type for each of these fields.
Figure 4–13: The Table Templates command builds a complete table with appropriate field types.
See Table 4–1 on page 158 for a full discussion of the various data types available within Access 2007.
|Inside Out-You Can Create and Modify Table Templates|| |
Access 2007 uses special schema files coded in XML to define the properties for the five table templates. These five files have an .accfl extension and are located in the following folder in a default 2007 Office release installation: Program Files\Microsoft Office\Templates\1033\Access. If you choose to modify these template files, we recommend that you back up the original file to a safe location. You can open the .accfl files using Notepad or an XML reader. These XML view files are created using XML Schema Definition (XSD) language to describe the structure of the new table template tables. Access reads these files to determine the structure of the template files and then builds them following the instructions. You can learn how to create and modify these files in Chapter 23, “Using XML.”
By default, Access 2007 assigned the name ID to the first field in this Contacts table. This field name is not very descriptive, so we will rename this field ContactID. There are several ways to rename a field using Access 2007, but for now we will focus on one of the easiest methods-renaming the field directly from Datasheet view. Double-click the heading of the ID field and then type ContactID, as shown in Figure 4–14. After you press Enter, Access immediately renames the field. Save this table now by clicking the Save button on the Quick Access Toolbar and name the table Contacts.
Figure 4–14: You can double-click a column heading in table Design view to change the name of the field.
You will further change this Contacts table later in this chapter and also in Chapter 5, so that it is more like the final tblContacts table in the Conrad Systems Contacts database. For now, close the Table window so that you can continue building other tables you need.