Creating a Table Using Application Parts

Creating a Table Using Application Parts

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 Proseware 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 manually, it could be quite a tedious process.

Fortunately, Access 2010 comes with a new feature called Application Parts to help you build a few common tables and other database objects. Let’s move on to a more complex task—building tables like those you find in Conrad Systems Contacts. To do this, click the File tab on the Backstage view and then click New. This returns you to the New tab, 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 Application Parts, close the table that Access 2010 created when you opened the database (Table1), click the Create tab on the ribbon, and then click the Application Parts button in the Templates group. Access displays a list of 10 form types under the Blank Forms category and five Application Parts under the Quick Start category, as shown in Figure 4-12. Microsoft also uses the term Models to refer to this one-click object creation feature. You’ll learn more about using the 10 form Application Parts in Chapter 13.

Application Parts help you create common types of database objects.

Figure 4-12. Application Parts help you create common types of database objects.

The five Application Parts under Quick Start, which represent some of the more common types of table structures and objects found in databases, are as follows:

Inside Out: What Happened to the Table Templates?

The five Table Templates from Access 2007 do not exist in Access 2010. Microsoft replaced the Table Templates with various Application Parts in Access 2010 so you can quickly build fields, tables, and other database objects commonly found in most databases.

Click Contacts in the Quick Start list, and Access 2010 builds a complete table structure for a contacts table as well as other supporting objects, as shown in Figure 4-13. Access creates a total of 20 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 Application Part 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 Quick Start command also automatically defines a data type for each of these fields.

Note

See Table 4-1, for a full discussion of the various data types available within Access 2010.

The Quick Start command builds a complete table with appropriate field types and supporting objects.

Figure 4-13. The Quick Start command builds a complete table with appropriate field types and supporting objects.

By default, Access 2010 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 2010, 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 the change to this table now by clicking the Save button on the Quick Access Toolbar.

You can double-click a column heading in Datasheet view to change the name of the field.

Figure 4-14. You can double-click a column heading in Datasheet view to change the name of the field.

You will further change this Contacts table later in this chapter and 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. Also, let’s delete all the other supporting objects the Application Part command created so we can concentrate just on the tables for now. Highlight the query called ContactsExtended in the Navigation pane and then press Delete. Click OK in the confirmation dialog box when Access prompts you to delete the object. Continue deleting the remaining three forms and four reports until you are left with just the Contacts table in the Navigation pane.