Field Properties (3)
Indexing a Field
Fields that you search frequently, can be indexed. By indexing fields you can perform searches faster, but keep in mind that this feature may delay when you add or update data. For this reason, when you add or change data, the index should be updated.
An indexed field is similar an index in a book. Here, the only difference is that in a book you have to go search for a word in the index but, in “Access” it itself searches out a word in the index.
A field that is marked as “Primary key” is automatically indexed.
By default, a field is not indexed and this 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 select multiple fields to index.
To delete an index, click the “Indexes” in the “Ribbon”, select the index you want to remove, in the dialog box that appears and click the “Delete” button on your keyboard.
Indexing a combination of fields
In “Access”, we also have the ability to index on a combination of fields.
In this example I created a table with the members of a club. This table has several fields, including the fields “Last Name” and “First Name”. It is possible to index the records based on these two fields.
To index on a combination of fields, click the “Indexes” in the “Ribbon” to open the “Indexes dialog.
The “Primary key” is already shown 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 relevant name for the index, for example, “LastName and FirstName” seems to be a good choice in this case. Then click in the “Last Name” column and click the downward pointing arrow that appears. Select the first field, in this case ” Last Name”, for the “combination index” from the drop-down list, then click the blank in the column “Field Name” below, and click the downward pointing arrow that appears. Select the second field, in this case “First Name” for the combination index, from the drop-down list. You can leave the “Index Name” column empty.
Close the dialog and save the table.
Click the “Datasheet View” in the “Ribbon”.
Select the “Last 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:
You've completed Lesson 15 START NEXT LESSON