Office 2007 - Access

Lesson 13: Design View (cont 3…)

13/72 Lessons 

“Field Properties” (3)

6. Indexing a Field

Fields that you often search or sort, better be indexed.
By indexing fields, you can perform searches faster, but keep in mind that this may delay when you add or update data.
This is for the simple reason that when you add or change data, the index should be modified.
Think of an indexed field as an index in a book.
Only here, the difference is that in a book, you have to go search for a word in the index but, here “Access” does the search for a word in the index.
les13_image001_en
A field that is a “Primary key” is automatically indexed.

By default, a field is not indexed and so the field property is set to “No”.
When we click the downward pointing arrow, we have two other options,
Yes (Duplicates OK), and Yes (No Duplicates). Both seem clear to me .
You can have indexing on multiple fields .

To delete an index, click the “Indexes” in the “Ribbon”, select the index you want to remove and in the dialog box that appears, click the “Delete” button on your keyboard.
les13_image002_en

7. Indexing on a combination of fields

In “Access”, we also have the ability to index on a combination of fields.

For this example, I quickly created a table with the members of a club. This table has several fields, including the “Last Name” and “First Name” fields.
It is possible to sort the records based on these two fields.

An example makes this clear.

To index on a combination of fields, click the “Indexes” in the “Ribbon”.
This opens the “Indexes” dialog.
The “Primary key” is already in this dialog, because the “Primary key” is automatically indexed.
To add a combination index, click the empty row under the “PrimaryKey” in the “Index Name” column .
Specify a name for the index, no matter what name, but something that is always relevant. For example, “LastName and First Name” seems a good choice in this case .
Then click in the “Field Name” column and click the downward pointing arrow that appears.
Select the first field, in this case ” LastName”, for the combination index from the drop-down list.
Then click on the blank cell in the “Field Name” column below, and click the downward pointing arrow that appears.
Select the second field, in this case the “First Name” for the combination index, from the drop-down list.
The “Index Name” column allows you to leave fields empty.
les13_image004_en
Close the dialog and save the table.
Click the “Datasheet View” in the “Ribbon”.

Select the “First Name” column and click the “Ascending” or “Descending” order in the “Ribbon” (1) or click the downward pointing arrow beside the column title (2) and select one of the two sorting options.
You will see that our members are first sorted by their last name and then their first name:
les13_image003_en

Awesome!
You've completed Lesson 13
START NEXT LESSON