• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 4. Creating Your Database and Ta... > Creating Your First Simple Table by ...

Creating Your First Simple Table by Entering Data

If you’ve been following along to this point, you should still have your new Kathy’s Wedding List database open with the Database window displaying the Tables pane, as shown in Figure 4-8. (You can also follow these steps in any open database.) Make sure the Tables button under Objects is selected, and then click the New button in the Database window to open the New Table dialog box, shown in Figure 4-9.

Figure 4-9. The New Table dialog box.

Select Datasheet View in the list, and then click OK to get started. (You can also just double-click Datasheet View in the list.) What you see next is an empty datasheet, which looks quite similar to a spreadsheet. Note that you also could have double-clicked Create table by entering data as shown in Figure 4-8—there’s usually more than one way to accomplish a task in Access. You can enter just about any type of data you want—text, dates, numbers, currency. But unlike in a spreadsheet, in a datasheet you can’t enter any calculated expressions. 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, first name, middle initial, last name, street address, city, state, postal code, number of guests invited, number of guests confirmed, gift received, and a gift acknowledged indicator. Be sure that each column contains the same type of data in every row. For example, enter the city name in the sixth column for every row.

You can see some of the data entered for the wedding invitee list in Figure 4-10. When you start to type in a field within a row, Access displays a pencil icon on the row selector at the far left to indicate that you’re adding or changing data in that row. Use the Tab key to move from column to column. When you move to another row, Access 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.

Figure 4-10. Creating a table in the Kathy’s Wedding List database by entering data.

If you create a column of data that you don’t want, click anywhere in the column and choose Delete Column from the Edit menu. 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 choose Column from the Insert menu. To move a column to a different location, click the field name at the top of the column to highlight 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 highlight them all. You can then move the columns as a group.

You probably noticed that Access 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 choose Rename Column from the Format menu. In Figure 4-11 on the next page, I have already renamed one of the columns and am in the process of renaming the second one.

Figure 4-11. Renaming 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 toolbar or by choosing Save from the File menu. Access displays a Save As dialog box, as shown in Figure 4-12. Type an appropriate name for your table, and then click OK. Access displays a message box warning you that you have no primary key defined for this table and offering 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,” page 102, for details about the AutoNumber feature. 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 the Design view of a table to define your own primary key(s) or to change the definition of an existing primary key. In this case, click Yes to build a field called ID that will serve as the primary key.

Figure 4-12. Saving your new table.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint