Creating Your First Simple Table by Entering Data
If you've been following along to this point, you should still have your new Martin's Party List database open with Table1 open in Datasheet view. (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 2010 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 this tutorial, you can easily display a calculated result using data from one or more fields by entering an expression in a Calculated data type.
Because we're starting a list of party 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.
When you start to type in a field in a row, Access 2010 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 2010 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 2010 guesses the most appropriate data type and displays it in the Data Type box on the Fields tab on the ribbon.
If you create a column of data that you don't want, click anywhere in the column and click Delete in the Add & Delete group of the Fields 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, right-click the column header to the right of where you want to insert the new column and then click Insert Field from the shortcut menu that appears. 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 2010 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 right-click a column header and then click Rename Field from the shortcut menu that appears. We have already renamed one of the columns and are in the process of renaming the second one.
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 File tab and then click Save. Access 2010 displays a Save As dialog box. Type an appropriate name for your table, and then click OK. If you deleted the ID field by mistake, Access 2010 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. If one or more of the data columns you entered would make a good primary key, click No in the message box. In this case, Access 2010 should not display a message box because it already generated the field called ID to serve as the primary key.
In this tutorial:
- Designing Client Tables
- Creating a New Database
- Creating a New Empty Database
- Creating Your First Simple Table by Entering Data
- Creating a Table Using Application Parts
- Creating a Table Using Data Type Parts
- Creating a Table in Design View
- Understanding Field Data Types
- Setting Field Properties
- Nulls and Zero-Length Strings
- Defining Simple Field Validation Rules
- Defining Input Masks
- Defining a Primary Key
- Defining a Table Validation Rule
- Understanding Other Table Properties
- Defining Relationships
- Defining Your First Relationship
- Creating a Relationship on Multiple Fields
- Adding Indexes
- Multiple-Field Indexes
- Setting Table Design Options
- Creating a Default Template for New Databases
- Printing a Table Definition
- Database Limitations