1. Indexing Field Values
When
you create an index of a field’s values, Access 2010 maintains an
internal record of the values in a field, which the program can then use
to find table records with specific values. Access 2010 always keeps an
index of a table’s primary key field’s values.
-
Open a table in Design view.
-
Click the field to index.
-
Click the Indexed property name.
-
Click the Indexed down arrow.
-
Click either Yes (Duplicates OK) or Yes (No Duplicates).
Try This!
Open the Northwind sample database, click Tables on the Objects bar,
double-click Products, and then click Design. Click any cell in the
ProductName row of the design grid, and then click Indexed in the Field
Properties section. Click the down arrow that appears and then click Yes
(No Duplicates). This change requires every new product entered into
the table to have a unique name. This specific change works for
Northwind, which carries unique products, but may not work for a
business that buys common items from more than one supplier.
Tip
Indexes work best in fields with lots of different values. In large
tables, indexing the values in commonly used fields lets Access 2010
find what you’re looking for quickly.
Caution
Access 2010 updates all its indexes every time you add or
update a table record. Creating unneeded indexes can greatly slow down
data entry, especially on older systems.
2. Validating Data Entry
Some
categories of data, such as credit limits or the date someone joined a
club, have to meet certain criteria. You can make sure data entered into
fields meets those criteria (for example, all credit limits are $5,000
or less) by performing data validation. When a user tries to enter data
that isn’t appropriate for the field, you can display a message letting
the user know what went wrong.
-
Open a table in Design view.
-
Click the field for which you want to validate data entry.
-
Click Validation Rule.
-
Click the Build button.
-
Create the validation rule in the Expression Builder.
-
Click OK.
-
Open a table in Design view.
-
Click the field to which you want to assign validation text.
-
Type your validation text in the Validation Text box.
Tip
You can type your validation rule, such as <=5000, directly into the Validation Rule box.