skip to main content



Skip navigation, view page content
Short Courses Schedule | OIT Home Page

Access 2007: Table Settings


As you've learned, when you create a new database Access starts you off with a single table that displays in Datasheet view for entering data. Design view provides a more powerful interface for formatting your table. You can use Design view to add, rearrange, and move fields, but you cannot use it to add data. Some settings you can adjust in Design view include: Data Type, Primary Key, Blank Fields, Default Values, Duplicate Values, Input Masks, Validation Rules, and Lookups.

To switch between Datasheet and Design view, use any of the following methods. Note all of the tasks covered below require you to have your table open in Design view. Also be aware when you switch back to Datasheet view after making changes in Design view you will be prompted to save your table.


Data Types

In addition to the three basic data types (text, numbers, and dates), Access provides a number of more specialized data types. There also are related field properties you can adjust based on the selected data type to further define how a field should be formatted. For example, if you have a text data field, you could set the maximum length, or for a numeric field, the number of decimal places it should allow. To change a field's data type and properties:


Top of page

Primary Key

Every table must have a primary key. The primary key is a field (or combination of fields) that organizes your data by uniquely identifying each record. By default, tables are sorted by primary key. When you create a table in Datasheet view, Access automatically creates a primary key field and labels it ID. You can change this name to something more descriptive if you like (e.g., Employee ID, Customer Number, etc.). If your table does not have a primary key field, perhaps because you created it in Design view, it is up to you to specify one. To do this:

Primary keys must be unique for each record; leaving a primary field blank is not an option. If your table does not contain something like a phone number or employee number, it is best to use an AutoNumber field so Access will sequentially assign numbers to each record in the table.


Top of page

Blank Fields

By default, every field in a new table (other than the primary key) is optional. To assure a particular field cannot be left blank, you can make it required. To do this:


Top of page

Default Values

An alternative way to handle a field is by defining a default value. In this case, Access automatically inserts predefined text or a number. To define a default value:


Top of page

Duplicate Values

As you have learned, every table should contain a primary key to make each record unique. However, in some cases you also may want to prevent duplicate information from being entered in another field (for example, two employees sharing the same payroll record number). You can force a field to require unique values by adding an index. This helps Access determine if you would be duplicating an existing field value when adding a new record. To do this:


Top of page

Input Masks

Input masks provide a way to control how data is entered into a field; for example, to automatically format telephone numbers or dates using a particular format. You can use input masks for Text, Numbers, Currency, and Date/Time data types. To add an input mask, do the following:

The Wizard works only with Text or Date field types. If the field you selected is a different type, you must manually enter the value in the Input Mask field on the General tab. If you do not see the exact format you want when using the Wizard, you can edit formatting by clicking edit list button; selecting the mask to update; and making the changes. You also can add a new format to the Wizard by clicking Wizard blank record button [New (blank) record].


Top of page

Validation Rules

While input masks can be used to control how information is entered according to a single unchanging pattern, Validation Rules can be used to apply more sophisticated restrictions to data entered in a field (for example, verifying that a number falls within a specified range, or that a date hasn't yet occurred, or even that text starts with a certain letter). The rule you create tells Access which values to allow and which ones are no good. To do this:

Creating a validation rule may seem simple, but to get the result you want, you will need to know more forming expressions. For more information, click Help button [Online Help button] and search for "Validation Rules."


Top of page

Lookups

Minor variations in a data field can cause problems when you try to analyze the data. A way around this is to use Lookups to provide a way of standardizing your data by allowing you to select from a ready-made list of choices. For example, you might put all courses offered in such a list. To create a Lookup with fixed values, do the following:

Top of page