Working with Table Data
Tables
are the basis of everything that you do in Access. Most of the data for
your database resides in tables. So if you’re creating an employee
payroll database, your employee data will be stored in a table, your
payroll codes might be stored in a table, and your past payroll records
could be stored in a table. A table contains data about a specific topic
or subject (for example, customers, orders, or employees). Tables are
arranged in rows and columns, similar to a spreadsheet. The columns
represent the fields, and the rows represent the records (see Figure 1).
Open an Access Table
In working with tables, the
first thing you’ll want to be able to do is open them in Datasheet view
and navigate around them. The text that follows covers all the basics of
working with tables in Datasheet view.
To open a table in Datasheet view, follow these steps:
1. | Select Tables in the list of objects in the Navigation Pane.
|
2. | Select the table you want to open and click the Open button in the Navigation Pane or double-click the table you want to open.
|
Navigating Around a Table
You
can move around a table by using the keyboard or mouse. When you are
editing or adding records, your hands are on the keyboard, and you might
find it easiest to move around a table by using the keyboard. However,
if you are looking for a specific record, you might find it most
convenient to use the mouse.
Table 1
shows the keyboard and mouse actions for moving around a table and
their resulting effects. As you can see, Microsoft Access provides
numerous keyboard and mouse alternatives for moving around a table.
Table 1. Keyboard and Mouse Actions to Move Around a Table
Keyboard Action | Mouse Action | Effect |
---|
Tab or right arrow | Click the right arrow on the bottom scrollbar. | Moves one field to the right of the current field |
Shift+Tab or left arrow | Click the left arrow on the bottom scrollbar. | Moves one field to the left of the current field |
Down arrow | Click the next record button. | Moves down one record |
Up arrow | Click the previous record button. | Moves up one record |
Page Down | No equivalent mouse action | Moves down one screen of records |
Page Up | No equivalent mouse action | Moves up one screen of records |
Home | No equivalent mouse action | Selects the first field of the current record |
End | No equivalent mouse action | Selects the last field of the current record |
Ctrl+Home | Click the first record button. | Moves to the first record of the table |
Ctrl+End | Click the last record button. | Moves to the last record of the table |
F2 | Click and drag within a field. | Selects the text in the field |
The insertion point does
not change locations just because you move your mouse, only the mouse
pointer moves when you move your mouse. You need to click within a field before you begin typing; otherwise, the changes occur in the original mouse location.
|
The tab displaying the data
includes tools that enable you to scroll through the fields and records,
move from record to record, expand and collapse to show and hide
related records, and more. Figure 2 illustrates these features. Table 2 provides a list of these features and provides a description of each.
Table 2. The Components of the Table Window
Table Component | Description |
---|
Table tab | Allows you to easily select the open table. |
Scrollbar | You can use the scrollbars to move up and down and right and left in the table. |
Navigation buttons | These icons enable you to select the first record, last record, next record, or previous record in the table. |
Expand indicator | The
expand indicator enables you to view the data hierarchy by showing you
any subdata records that are linked to the main record. |
Closing a Table
When you are finished
working with a table, you need to close it. To close a table, you choose
File, Close or click the close button in the upper-right corner of the
Table tab.
Access often prompts you as you
close a table, asking if you want to save changes to the layout of the
table. It is important that you understand that Access is not
asking whether you want to save changes to the data. As you’ll learn in
a moment, Access saves changes to data the moment you move off a
record. When you close a table and Access prompts you, it is asking
whether you want to save formatting changes, such as changes to column
width, to the look of the datasheet, and so on.
Editing Table Data
You can change the data in a
table any time that you are in Datasheet view of a table, the result of a
query, or Form view of a form. Access saves changes you make to a
record as soon as you move off the record.
Edit Existing Records
One task you might want to perform is to simply modify table data. Here’s the process:
1. | Select the record you want to change by using any of the techniques listed in Table 2.
|
2. | Select the field you want to change by clicking the field or using the arrow keys.
|
3. | Type to make the necessary changes to the data. Once you move off the record, Access saves your changes.
|
Undoing Changes
There are different
options available when undoing changes to a field or to a record. The
options differ depending on whether you are still within a field, have
left the field, or have left the record. The sections that follow
explore the various options available to you.
Undoing Changes Made to the Current Field
When you are in the process
of making changes to a field, you might realize that you really didn’t
want to make changes to that field or to that record. To undo changes to
the current field, you can either click the Undo tool on the
QuickAccess toolbar or press the Esc key once. For example, if you mean
to change the contact first name from Alison to Sue, but realize that
you are accidentally typing Sue in the Customer field, you can press the
Esc key once, or click the Undo tool on the QuickAccess toolbar, to
undo your change.
Undoing Changes After You Move to Another Field
The process of undoing
changes after you move to another field is identical to that of the
process of undoing changes made to the current field. You can either
click the Undo tool on the QuickAccess toolbar or press the Esc key
once. For example, if you mean to change the contact first name from
Alison to Sue, but realize that you accidentally typed Sue in the
Customer field, and then moved to another field, you could click the
Undo tool on the QuickAccess toolbar, or press the Esc key once, to undo
your change.
Undoing Changes After You Save a Record
When
you make changes to a field and then move to another record, Access
saves all changes to the modified record. So long as you do not begin
making changes to another record, you can still undo the changes you
made to the most recently modified record. To do this, you can either
click the Undo tool on the QuickAccess toolbar or press the Esc key
twice. For example, if you mean to change the contact first name from
Alison to Sue, but realize that you accidentally typed Sue in the
Customer field, and then moved to another record, you either click the
Undo tool on the QuickAccess toolbar or press the Esc key twice to undo
your change.
If Access is unable to undo a change, the Undo tool appears dimmed.
|
After you have made
changes to a record and then have gone on to make changes to another
record, you cannot undo the changes that you made to the first record.
Adding Records to a Table
Access adds records to the end of a table, regardless of how you add them to the table.
Add Records to a Table
To add records, follow these steps:
1. | Select the table to which you want to add information.
|
2. | Click the New Record Navigation button at the bottom of the Datasheet window.
|
3. | Add the necessary information to the fields within the record. When you move off the record, Access saves the new record.
|
You can use Ctrl + “ to repeat the data in the field directly above the current field.
It is also important to note
that Access always displays one blank record at the end of a table. When
entering data, pressing the Tab key at the end of a record that you
just added allows you to continue to add additional records.