Access 2010

Working with Tables

Introduction

Access 2010

While there are four types of database objects in Access 2010, tables are arguably the most important. Even when you're using forms, queries, and reports, you're still working with tables because that's where your data is stored. Tables are at the heart of any database, so it's important to understand how to use them.

In this lesson, you will learn how to open tables , create and edit records , and modify the appearance of your table to make it easier to view and work with.

In this lesson, we will work with the tables in our sample database. If you would like to follow along, download our example and use it to follow the procedures demonstrated in this lesson.

Table basics

If you're new to Microsoft Access, you'll need to learn the basics of working with tables so you can open, navigate, add information, and edit them.

To open an existing table:

  1. Open your database, and locate the Navigation pane .
  2. In the Navigation pane , locate the table you want to open. Tables are marked with a grid icon.
  3. Double-click the name of the table. It will open and appear as a tab in the Document Tabs bar .
    Opening a table Opening a table

Understanding tables

All tables are composed of horizontal rows and vertical columns , with small rectangles called cells in the places where rows and columns intersect. In Access, rows and columns are referred to as records and fields .

Records, fields, and cells in an Access table Records, fields, and cells in an Access table

A field is a way of organizing information by type. Think of the field name as a question, and every cell within that field as a response to that question.

Fields and field names Fields and field names

A record is one unit of information. Every cell on a given row is part of that row's record. Each record has its own ID number . Within a table, each ID number is unique to its record and refers to all of the information within that record. The ID number for a record cannot be changed.

Records and record ID numbers Records and record ID numbers

Each cell of data in your table is part of both a field and a record . For instance, if you had a table of names and contact information, each person would be represented by a record, and each piece of information about each person—name, phone number, address, and so on—would be contained within a distinct field on that record's row.

Click the buttons in the interactive below to learn how to navigate a table.

edit hotspots

To navigate between fields , you can use the left and right arrow keys or scroll left and right .

Adding records and entering data

Entering data into tables in Access is similar to entering data in Excel. To work with records, you'll have to enter data into cells . If you need help entering data into records, you may want to review our Cell Basics lesson from our Excel 2010 tutorial.

To add a new record:

There are three ways to add a new record to a table:

  • In the Records group on the Home tab, click the New command.
    Adding a new record from the Ribbon Adding a new record from the Ribbon
  • On the Record Navigation bar at the bottom of the window, click the New Record button.
    Adding a new record from the record navigation bar Adding a new record from the Record Navigation bar
  • Simply begin typing in the row below your last added record.
    Adding a new record by typing below the last record Adding a new record by typing in the row under the last record

Occasionally when you enter information into a record, a window will pop up to tell you the information you've entered is invalid. This means the field you're working with has a validation rule , which is a rule about the type of data that can appear in that field. Click OK , then follow the instructions in the pop-up window to re-enter your data.

An example of a validation warning An example of a validation warning

To save a record:

  1. Select the Home tab, and locate the Records group.
  2. Click the Save command.
    Saving a record Saving a record

Be sure to save any unsaved records before closing a table. Access will not prompt you to save them when you close the table.

Editing records

To quickly edit any record within a table, simply click it and type your changes. However, Access also offers you the ability to find and replace a word within multiple records, as well as to delete records entirely.

To replace a word within a record:

You can edit multiple occurrences of the same word by using Find and Replace , which searches for a term and replaces it with another term.

  1. Select the Home tab, and locate the Find group.
  2. Select the Replace command. The Find and Replace dialog box will appear.
    The Find command The Replace command
  3. Click the Find What: box, and type the word you want to find.
    Entering the term to find Entering the term to find
  4. Click the Replace With : box, and type the word you want to replace the original word.
    Entering the replacement text Entering the replacement text
  5. Click the Look In: drop-down arrow to select the area you want to search.
    • Select Current Field to limit your search to the currently selected field.
    • Select Current Document to search the entire table.
    Selecting where in the table to look Choosing where in the table to look
  6. Click the Match: drop-down arrow to select how closely you'd like results to match your search.
    • Select Any Part of Field to search for your search term in any part of a cell.
    • Select Whole Field to search only for cells that match your search term exactly.
    • Select Beginning of Field to search only for cells that start with your search term.
    Choosing how closely the records should match your search Choosing how closely the records should match your search
  7. Click Find Next to find the next occurrence of your search term.
    Clicking Find Next to view the next match for your search Clicking Find Next to view the next match for your search
  8. Click Replace to replace the original word with the new one.
    Replacing the original word with a new one Replacing the original word with a new one

While you can use Replace All to replace every instance of a term, replacing them one at a time allows you to be absolutely certain you edit only the data you want. Replacing data unintentionally can have a negative impact on your database.

The unintended consequences of choosing Replace All The unintended consequences of choosing Replace All

To delete a record:

  1. Select the entire record by clicking the gray border at the left side of the record.
    Selecting a record Selecting a record
  2. Select the Home tab, and locate the Records group.
  3. Click the Delete command. The record will be permanently deleted.
    The Delete Command The Delete Command

The ID numbers assigned to records stay the same even after you delete a record. For example, if you delete the 34th record in a table, the sequence of record ID numbers will read ...32, 33, 35 , 36... rather than ...32, 33, 34 , 35, 36...

A missing ID number after a record has been deleted A missing ID number after a record has been deleted

Modifying table appearance

Access 2010 offers several ways to modify the appearance of tables. These changes aren't just about making your table look nice; they can make the table easier to read too.

Resizing fields and rows

If your fields and rows are too small or large for the data contained with them, you can always resize them so all of the text is displayed.

To resize a field:

  1. Place your cursor over the right gridline in the field title . Your mouse will become a double arrow Double-arrow .
    Resizing a field Resizing a field
  2. Click and drag the gridline to the right to increase the field width or to the left to decrease the field width.
  3. Release the mouse. The field width will be changed.
    The resized field, now with all the text fully displaying The resized field, now with all the text fully displaying

To resize a row:

  1. Place your cursor over the bottom gridline in the gray area to the left of the row. Your mouse will become a double arrow Double-arrow .
    Resizing a row Resizing a row
  2. Click and drag the gridline downward to increase the row height or upward to decrease the row height.
  3. Release the mouse. The row height will be changed.
    The resized row, now with all the text fully displaying The resized row, now with all the text fully displaying

Hiding fields

If you have a field you don't plan on editing or don't want other people to edit, you can hide it. A hidden field is invisible but is still part of your database. Data within a hidden field can still be accessed from forms, queries, reports, and any related tables.

To hide a field:

  1. Right-click the field title .
  2. From the drop-down menu, select Hide Fields .
    Hiding a field Hiding a field
  3. The field will be hidden.

If you decide you would like the field to be visible again, you can unhide it. Simply right-click any field title, then select Unhide Fields . In the dialog box, click the check boxes of any fields you would like to be visible again, then click Close .

Unhiding a hidden field Unhiding a hidden field

Table formatting options

Alternating row color

By default, the background of every other row in an Access table is a few shades darker than the background of the rest of the table. This darker alternate row color makes your table easier to read by offering a visual distinction between each record and the records directly above and below it.

A table with alternate row colors A table with alternate row colors

To change the alternate row color:

  1. Select the Home tab, and locate the Text Formatting group.
  2. Click the Alternate Row Color drop-down arrow.
    The Alternate Row Color drop-down arrow The Alternate Row Color drop-down arrow
  3. Select a color from the drop-down menu, or select No Color to remove the alternate row color.
    The Alternate Row Color drop-down color menu The Alternate Row Color drop-down color menu
  4. Your alternate row color will be updated.
    The updated alternate row color The updated alternate row color

Modifying gridlines

Another way Access makes your tables easier to read is by adding gridlines that mark the borders of each cell. Gridlines are the thin lines that appear between each cell, row, and column of your table. By default, gridlines are dark gray and appear on every side of a cell, but you can change their color or hide undesired gridlines.

Horizontal and vertical gridlines Horizontal and vertical gridlines

To customize which gridlines appear:

  1. Select the Home tab, and locate the Text Formatting group.
  2. Click the Gridlines drop-down arrow.
    The Gridlines drop-down arrow The Gridlines drop-down arrow
  3. Select the gridlines you want to appear. You can choose to have horizontal gridlines between the rows, vertical gridlines between the columns , both types of gridlines, or none at all.
    Selecting horizontal gridlines Selecting horizontal gridlines
  4. The gridlines on your table will be updated.
    The updated horizontal-only gridlines The updated horizontal-only gridlines

Additional formatting options

To view additional formatting options, click the Datasheet Formatting arrow in the bottom-right corner of the Text Formatting group.

The Datasheet Formatting arrow The Datasheet Formatting arrow

The Datasheet Formatting dialog box offers several advanced formatting options, including the ability to modify background color, gridline color, and border and line style. It even includes the ability to view a sample table with your formatting choices, so play around with the various formatting options until you get your table looking the way you want it.

Changing the table background color and gridline style Changing the table background color, gridline color, and border and line style

Challenge!

  1. If you haven't already, download our sample database and open it.
  2. Open the Customers table.
  3. Add a new record to the table. Be sure to enter data for every field.
  4. F ind the record with the name Tyra Kirby, and replace it with a name of your choice.
  5. Change the alternate row color .
  6. Hide a field, then unhide it.