
- •7 Work with package ms Office: ms Access
- •Database Basics
- •Database Tables
- •Records and Fields
- •Using a Key Field
- •Looking at Access
- •Creating a Database
- •Understanding Database Objects
- •To Do: Create a Table
- •Setting Field Properties
- •Setting the Key and Saving the Table
- •Modifying Table Structures
- •Viewing Table Design and Entering Simple Data
- •Summary
Using a Key Field
Every Access table requires a primary key field. The primary key field (often just called a key) is a field that contains a unique value and no duplicate entries. Whereas a table's city field might contain multiple occurrences of the same city name, a key field must be unique for each record. You can designate an existing data field as the table's key field, or you can use the AutoNumber field that Access adds to all tables as the key field.
Note
If you access a particular field very often, even if that field is not a key field, designate it as an index field in the Design view property settings. Access creates an index for every database and locates the index fields in that index. Just as an index in the back of the book speeds your searches for particular subjects, the index field speeds searches for that field.
If you were creating a table to hold employee records, a good key-field candidate would be the employee's Social Security number because each one is unique. If you are not sure that your data contains unique information in any field, specify the AutoNumber field that Access creates as the key. In the AutoNumber field, Access stores a unique number for each table record.
Access uses the key field to find records quickly. When you want to locate an employee's record, for example, search by the employee's key field (the Social Security number). If you search based on the employee's name, you might not find the proper record; two or more employees might be named John Smith, for example.
Note
So many companies assign you a customer number because the customer number uniquely identifies you in their database. Although today's computerized society sometimes makes one feel like "just another number," such a customer number enables the company to keep your records more accurate and keep costs down.
Looking at Access
When you start Access, you'll see a screen that looks similar to Word, as Figure 17.3 shows. The New File task pane provides you with links you can use to create a new database or load an existing database. As with Word and Excel, Access supports the use of template files on which you can base new database files that conform to a predetermined pattern.
Figure 17.3 The Access screen is empty when you launch Access from the Start menu.
Here are the fundamental steps you follow most of the time when you want to work with Access:
-
Open an existing database so that you can modify the database structure or work with the database information. Select a database from the list or click the More option to browse a list of existing database files. The section of the New File task pane where you open an existing database is labeled Open.
-
Create a new database, which requires that you manually set up the entire database structure, including tables, fields, and other pertinent database-structure information. You can also create a more advanced database project, which creates a database system that runs in a networked client/server workspace where the Access database might transfer data to multiple workstations attached to the server. The section of the New File task pane where you create a blank database is labeled New.
-
Create a new database that is a copy of an existing database. The New File task pane contains the section for creating a new database file from an existing one. You can get to this option by selecting More. This New File task pane option in effect makes a copy of an existing database file.
-
Create a database file based on a template. Access provides templates that create sample blank databases that track data such as asset management, expenses, and inventories. Microsoft provides additional templates on the Web as well.