If you’ve been following along to this point, you should still have your new Kathy’s Wedding List database open with Table1 open in Datasheet view, as shown in Figure 4–8. (You can also follow these steps in any open database.) What you see is an empty datasheet, which looks quite similar to a spreadsheet. Access 2007 automatically created the first field, called ID, in the left column. Leave this field intact for now. In the second column Access has placed another field with the Add New Field heading. You can enter just about any type of data you want in this field-text, dates, numbers, or currency. But unlike a spreadsheet, you can’t enter any calculated expressions in a datasheet. As you’ll see later in the chapters about queries, you can easily display a calculated result using data from one or more tables by entering an expression in a query.
Because we’re starting a list of wedding invitees, we’ll need columns containing information such as title, last name, first name, middle initial, street address, city, state, postal code, number of guests invited, number of guests confirmed, gift received, and a gift acknowledged indicator. Be sure to enter the same type of data in a particular column for every row. For example, enter the city name in the seventh column (named Field6 by Access) for every row.
You can see some of the data entered for the wedding invitee list in Figure 4–9. When you start to type in a field in a row, Access 2007 displays a pencil icon on the row selector at the far left to indicate that you’re adding or changing data in that row. Press the Tab key to move from column to column. When you move to another row, Access 2007 saves what you typed. If you make a mistake in a particular row or column, you can click the data you want to change and type over it or delete it. Notice that after you enter data in a column, Access 2007 guesses the most appropriate data type and displays it in the Data Type box on the Datasheet tab on the Ribbon.
Figure 4–9: You can create the wedding invitee list table by entering data.
If you create a column of data that you don’t want, click anywhere in the column and click Delete in the Fields & Columns group of the Datasheet contextual tab on the Ribbon. Click Yes when Access asks you to confirm the deletion. If you want to insert a blank column between two columns that already contain data, click anywhere in the column to the right of where you want to insert the new column and then click Insert in the Fields & Columns group of the Datasheet tab on the Ribbon. To move a column to a different location, click the field name at the top of the column to select the entire column, and then click again and drag the column to a new location. You can also click an unselected column and drag your mouse pointer through several adjacent columns to select them all. You can then move the columns as a group.
You probably noticed that Access 2007 named your columns Field1, Field2, and so forth-not very informative. You can enter a name for each column by double-clicking the column’s field name. You can also click anywhere in the column and then click Rename in the Fields & Columns group on the Datasheet tab. In Figure 4–10, we have already renamed one of the columns and are in the process of renaming the second one.
Figure 4–10: Double-click the column heading or click Rename in the Fields & Columns group on the Ribbon to rename a column in Datasheet view.
After you enter several rows of data, it’s a good idea to save your table. You can do this by clicking the Save button on the Quick Access Toolbar or by clicking the Microsoft Save Office Button and then Save. Access 2007 displays a Save As dialog box, as shown in Figure 4–11. Type an appropriate name for your table, and then click OK. If you deleted the ID field by mistake, Access 2007 displays a message box warning you that you have no primary key defined for this table and offers to build one for you. If you accept the offer, Access adds a field called ID and assigns it a special data type named AutoNumber that automatically generates a unique number for each new row you add. See “Understanding Field Data Types” on page 157 for details about AutoNumber. If one or more of the data columns you entered would make a good primary key, click No in the message box. In Chapter 5, “Modifying Your Table Design,” you’ll learn how to use Design view to define your own primary key(s) or to change the definition of an existing primary key. In this case, Access 2007 should not display a message box, because it already generated the field called ID to serve as the primary key.
Figure 4–11: Access 2007 displays the Save As dialog box when you save a new table so that you can specify a table name.