Project 11: Creating A Customized Database

UNIT 2
PROJECT 11
C REATING
A C USTOMIZED
D ATABASE
IN THIS PROJECT, YOU LEARN HOW TO

Examine a Database and Its Objects

Create Tables and Set Field Properties in Design View

Create Relationships

Add and Delete Records

Create a Form Using the Form Wizard

Create a Report Using the Report Wizard
Project 11
Creating A Customized Database
UNIT 2: 875
WHY WOULD I DO THIS?
A database is a collection of related facts—or data—stored together in one file.
Mi cro soft Offi c e Acc ess is a computerized database management system that enables
you to store, retrieve, analyze, and print information. It is a system for managing large
amounts of data. Companies use databases for many purposes: to manage customer files,
to track orders and inventories, and for marketing purposes. An individual might set up a
database to track household expenses or manage a list of family, friends, and business
addresses. Teachers often set up a database to track students’ grades and other class
information. A database enables the user to access and manage thousands of pieces of
data in an organized, efficient, and accurate manner.
To begin using Access, there are a number of terms that you need to understand. An
Access database consists of tables , queries , forms , reports , pages , macros, and
modules , which are all generally known as objects . These objects work together to
store, search, input, report, and automate the data. The following is a brief explanation of
the purpose of each object.

Tables are the foundation of the database because they store the data that
makes up the database. Each table stores a set of related data.

Queries are used to sort, search, and limit the data to just those records that
you want to see.

Forms are used to input, edit, or view data, generally one record at a time.

Reports are used to summarize information for printing and presentation of
the data.

Pages are a type of Web page designed for viewing and working with data
from the Internet or over an intranet.

Macros are used to automate existing Access commands.

Modules are programs in the Visual Basic programming language that are
used to customize the database for special needs.
In this project, you first examine the four main objects in a database: tables, forms,
reports, and queries. Then you open another database, add a table, add records, and
create a form and a report. Queries are covered in depth in Project 12.
VISUAL SUMMARY
In this project, you add objects to a database for the Armstrong Pool, Spa, and Sauna
Company. You create an Orders table and enter new records. You create a Contractors
form and a Contact List report. Figure 11.1 shows the form that you create, and Figure 11.2
shows the report.
UNIT 2: 876
Using Productivity Software
Form
created
FIGURE 11.1
Report
created
FIGURE 11.2
LESSO N 1: Ex amining a Dat abase and Its Objects
This textbook introduces you to the four main Microsoft Office Access objects: tables,
forms, reports, and queries. Each object has at least two views. The Design view is used
to create and modify objects, whereas the object view is used to view the data. In tables or
queries this is known as the Datasheet view , in a form it is the Form view , and in a
report it is the Print Preview of the report.
In this lesson, you open a database and save a backup copy of the database. You then
open each of the four main objects to see the data and to examine the design of a table
and a query.
All of these exercises can be completed with Microsoft Office 2007. Instructions
throughout the lessons are based on the Windows XP operating system, running
Microsoft Office 2007. Your screen may differ slightly from the figures shown, even if you
are running Office 2007.
Project 11
Creating A Customized Database
UNIT 2: 877
To Examine the Database window
1. Start Microsoft Access; click More on the Open Recent Database task
pane. The Open dialog box displays. As with other applications, use the Open dialog
box to locate and open files.
2. Locate and open AC_1101 in the Student folder for this chapter. Click
the Office button, point to Save As, and then from the submenu, click
Access 2002-2003 Database. If a Read-Only bar displays under the
Ribbon, click Save As on the right end of the bar. The Save As dialog box
displays. Here you can save the file with a new name and in a folder of your choice.
3. Navigate to the drive and folder where you are saving your files; in the
File name box type Personnel and then click Save.
4. In the Security Warning bar under the Ribbon click the Options button,
click Enable this Content, and then click OK. The file opens and displays the
Access window. The Tables object displays in the Navigation Pane on the left, and
one table—Personnel—is listed. The Access window displays four Access tabs on the
Ribbon—Home, Create, External Data, and Database Tools. Notice that the title bar
displays the filename and (Access 2002-2003 file format). The file format refers to the
version of Access that you selected when you saved the file. This file can be opened
with earlier versions of Access.
If you hav e problems...
The latest version of Windows has more sensitive security precautions than earlier
versions. Depending on your version of Windows and the security settings on your
computer, you may see a Security Warning box every time you open an Access
database. This warning box advises you that the file may not be safe to open if it
contains code that was intended to harm your files. Because databases use objects
that are interconnected and may contain macros, this security warning displays as a
precaution. Macros in Access are used to manage files. The files that you use in
this textbook are safe to open, so each time you see this security warning, click
Open to continue.
5. Examine Figure 11.3 to identify each component of the Access window
and read the explanation for each part of the window found in Table
11.1 that follows this figure.
Object list
arrow
Tables object list
Navigation
Pane
Shutter Bar
Open/Close
Button
FIGURE 11.3
UNIT 2: 878
Using Productivity Software
COMPONENT
DESCRIPTION
Access Ribbon
Four tabs—Home, Create, External Data, and Database Tools—
display on the Access Ribbon. Contextual tabs will become
available when objects are open and will change depending on the
view of the object displayed.
Navigation Pane
Used to navigate between objects. The currently active object
displays in orange. The names of available objects for that type of
object are listed under the object type. In Figure 11.3, Tables is the
object type and Personnel is the only table that is listed for this
database. Personnel is also the active object as seen by the orange
highlighting. You can display one or all types of objects.
Object list
The objects for the currently active object type(s).
Object list arrow
Displays a list of options for organizing and displaying objects on
the Navigation Pane
Shutter Bar
Open/Close
Button
Used to collapse or expand the Navigation Pane
TABLE 11.1
In the first steps in this lesson you opened a database, saved a copy of the database file
with a new name, and identified the main elements of the Access window. This process is
different from the process used to create copies of Microsoft Office Word, Excel, and
PowerPoint files. In each of those applications, you open a file, make changes to it, and
then optionally you can save it with a new name, preserving the original fine. When you
open an Access files, any changes made are preserved in the original file. If you want to
create a new file with a new name, it needs to be done before any changes are made. In
this portion of the lesson, you explore the objects in the Personnel database.
To Examine Database Objects
1. In the Navigation Pane, double-click Personnel under the Tables
object list. The Table Tools Datasheet tab becomes available on the Ribbon.
The Datasheet view displays the records in the Personnel table. Records contain
all of the related facts about a single person, place, object, or event. In this
example, the records contain personnel data. Each record is composed of fields. A
field is the smallest useable fact collected for each record. In this example, fields
include First Name, Last Name, Home Phone, and Birth Date, to name a few.
Notice that the field names display across the top of the Personnel Table
datasheet, and the data for any particular field displays in a column. The records
display in rows. At the bottom of the datasheet are navigation arrows that are used
to navigate between records in the table. Notice that there are six records in this
table and record 1 is the active record as shown in Figure 11.4.
Project 11
Creating A Customized Database
UNIT 2: 879
Field names
Active record
Number of records in
table
Navigation bar
First record button
Next record
button
FIGURE 11.4
2. In the bar at the bottom of the Personnel table, click the Next record
button twice. The record indicator moves to the third record—Margaret
Peacock—which is now the active record. Notice that 3 of 6 displays in the
navigation record box. The navigation bar displayed at the bottom of the table is
also used to navigate records in other objects.
3. Click the First record button; the first record becomes the active
record. You can also click the select record box to the left of a record to make it
active, or click on the record itself.
4. On the Navigation Pane, click the Shutter Bar Open/Close button to
shrink the size of the Navigation Pane. On the Home tab, in the
Views group, click the View button. On the Personnel title bar, click
the Maximize button. The Table Tools Design tab displays, and the Design
view of the table displays as shown in Figure 11.5. The top part of the Table
Design view lists the field names, data types, and any description for the fields. The
Field Properties area at the bottom of the table design lists properties for the
selected field. The first field listed—EmployeeID—is active by default, and the
properties shown on the bottom are the EmployeeID field properties. Properties
are characteristics that define a field such as the size of the field. The window
control buttons (Minimize, Maximize and Close buttons) for the Personnel table
display at the right end of the tab bar.
UNIT 2: 880
Using Productivity Software
Shutter Bar
Open/Close button
Data types
Field names
Description area
Fiel d properties
FIGURE 11.5
5. Click on each field and observe the change in data type and field
properties for the active field. The data type determines the kind of data
that can be entered. The field property options change depending on the data type.
6. Click the Close button at the right end of the tab bar. The Table Design
view closes The Navigation Pane for this database remains open, but collapsed at
the left side of the window.
7. In the Navigation Pane, click the Shutter Bar Open/Close button, and
then click the Objects list arrow to the right of Tables. At the bottom
of the displayed list click All Access Objects. The four main object
types—Tables, Queries, Forms, and Reports are listed, with the objects that have
been created for each object type displayed underneath. The title on the
Navigation Pane changes from Tables to All Access Objects.
8. On the Navigation Pane, under Forms, double-click PersonnelListing .
The PersonnelListing form displays as shown in Figure 11.6. Objects can also be
opened right-clicking the object name and then choosing Open from the submenu.
This form is based on the Personnel table and displays the records one at a time in
a form. When you look at data in a form, you are looking at the data that is stored
in one or more tables. Forms are used to enter and edit records, and are most often
designed to view one record at a time. Notice the navigation buttons at the bottom
of the form window.
Project 11
Creating A Customized Database
UNIT 2: 881
First record from
the Personnel
table is displayed
Navigation
buttons
FIGURE 11.6
9. Click the Close button on the form title bar. In the Navigation Pane,
under Queries, double-click Commission . The Commission query displays
only three records and three fields as shown in Figure 11.7. Queries are used to
search, sort, and limit the data in your tables to display only those records that
match specified conditions. Queries enable you to display only those records that
answer a specific question, in this case, which employees are paid commission.
Notice the Navigation bar at the bottom of the Query window.
Only three fields
display
Three records
display
FIGURE 11.7
10. On the Home tab, in the Views group, click the View button. The
Design view of the Commission: Select Query displays as shown in Figure 11.8,
and the Query Tools Design tab is active on the Ribbon. The top portion of the
window shows a field list for the Personnel table upon which this query is based. A
field list is a box that lists all of the fields in a table or query. The bottom portion
of the window is the query grid, which is used to design the query. Here you list the
fields you want to include in your query, determine the sort order, and insert a
value in one or more of the criteria boxes in order to limit the records displayed.
Notice that Yes displays on the Criteria row under the Commission field.
UNIT 2: 882
Using Productivity Software
Field list box for
Personnel table
Three fields
included in query
grid
Criteria inserted under
Commission field
FIGURE 11.8
11. Click the Close button on the Commission title bar to close the
Query window.
12. In the Navigation Pane, under Reports, notice that there are three
reports listed. Double-click Commission to display the Commission
report. This report is based on the Commission query that you just examined. As
you move your mouse pointer over the report, it displays as a magnifying glass.
Reports are always displayed in Print Preview mode, so you see how the report
will look when it is printed.
13. Click on the left portion of the line at the bottom of the report. The
report is magnified and the current date displays on the bottom of the report. This
is part of the formatting that is applied to a report when it is created.
14. Use the vertical and horizontal scroll bars to scroll up and view the
three records that are listed.
15. Click the Close button on the QryCommission title bar. Click the
Office button and at the bottom of the list click Close Database to
close this file but leave the Access program open. The Getting Started
with Microsoft Access Window displays.
TO EXTEND YOUR KNOWLEDGE…
USING THE VIEW BUTTON
On the Home tab, the View button is used to move between viewing the records and
viewing the design of an object. The icon on the button changes between a design
icon and a table datasheet, form, or report icon, depending on the currently active
object and view. If you are viewing a table datasheet, the icon on the button will
display a design icon. This indicates that the Design view will display when the button
Project 11
Creating A Customized Database
UNIT 2: 883
is clicked. Similarly, when you are in the Design view of a table, the View button
displays a datasheet icon to indicate that the Datasheet view will display when the
button is clicked. The icon on this button similarly changes when you are working
with a query, form, or report. Use this button to move between the Design view and
viewing the records for each of the objects.
CONTEXTUAL TABS
When you open an object, a contextual tab may displays. For example, when you
open a table, the Table Tools Datasheet tab displays. If you open a form, in the
Layout view, the Form Layout Tools Format tab, and Arrange tab display. The
contextual tabs change depending on the type of object that is open and the view that
is displayed—Datasheet view, Form View, Design View and others. The buttons that
are on the tab are related to the active object and the view of that object that is
currently displayed. Some of the tabs contain the same buttons.
FIELD NAMES
Field names can be up to 64 characters long and include any combination of letters,
numbers, spaces, and special characters except a period (.), an exclamation point (!),
an accent grave (`), or brackets ([ ]). In many databases, spaces are not used in field
names because they can create a conflict when using Microsoft Visual Basic for
Applications (VBA) , which is the programming language used to write modules in
Microsoft Office Access. When spaces are not used for field names it is common
practice to capitalize each word in a field name.
LESSO N 2: Creating Tables and Set ting F ield
P ropert ies in Design View
When you create a table, you name the fields, identify the type of data that each field will
contain, set field sizes, and add descriptions if necessary. It is important to ensure that all
data entered in a table is accurate. One of the ways you do this is to set field properties,
which control the data that is entered and the way the data displays on the screen. Before
you create a table in Access, you need to spend some time designing the table. The first
step in designing a table is to decide what the table is about: What is the main purpose of
the table? Then you identify the fields that should be included in the table and define the
data type for each field. The data type determines what kind of data may be entered in a
field. It helps ensure that inappropriate data is not entered in a field, such as alphabetic
characters in a number field.
Table 11.2 describes the 10 data types that are available.
ACCESS DATA TYPES
DA TA TY PE
EXPL A NA TIO N
Text
Default data type, used for text and numbers up to 255 characters;
used for numbers that are not in calculations such as phone
numbers.
UNIT 2: 884
Using Productivity Software
Memo
Used for long text or combinations of text and numbers; up to
63,999 characters or limited by the size of the database.
Number
Used for numeric data that may be included in calculations.
Date/Time
Date and time values for the years 100 through 9999.
Currency
Currency values and numeric data used in mathematical
calculations involving data with one to four decimal places.
AutoNumber A unique sequential number incremented by 1 automatically with
each new record added to the table.
Yes/No
A Yes/No field type limits your data to one of two conditions. You
can enter only Yes or No, True or False, or On or Off.
OLE Object
Used to insert Object Linking and Embedding (OLE)
objects, such as pictures or charts created in another application.
Hyperlink
Text or combinations of text and numbers stored as text and used
as a hyperlink address.
Attachment
Any supported file type may be attached to a table such as images,
spreadsheet files, or documents.
Lookup
Wizard
A field that allows you to choose a value from another table or
from a list of values. Clicking this option starts the Lookup Wizard,
which creates a Lookup field.
TABLE 11 2
After you have designed the table and decided on the data type for each field, you can
add the table to your database. In this lesson, you open an existing database and save it
with a new name. The Armstrong Pool, Spa, and Sauna Company created this database to
track customer orders and the contractors who will install the products that have been
sold. The database already contains a table of contractors who do the installations. You
will create the Orders table for this database and set the field properties. The table you
create contains information about the orders placed by customers.
To Create Tables
1. Open Access if necessary. In the Open Recent Database pane, click
More. Locate and open the AC_1102 database. Click the Office
Button, point to Save As, and in the submenu click Access 2000. In
the Save As dialog box, navigate to the folder containing your
student work and save the file with the name Armstrong.
Project 11
Creating A Customized Database
UNIT 2: 885
2. On the Security Warning bar, click the Options button, click Enable
this content, and then click OK. The Armstrong database uses the Access
2000 file format as indicated in the title bar. The Tables object list displays and
Contractors is the only table listed.
3. In the Navigation Pane, under Tables, double-click Contractors to
view the contents of this table. This table lists the contractors that are used
by the Armstrong Company to install pools, spas, and saunas. It includes
information about each contractor, including a ContractorID field that identifies
each contractor with a special ID code. This type of field is called the primary key
field, because each ContractorID is unique and cannot be repeated in this table.
4. Close the Contractors table.
5. Click the Create tab, and in the Tables group click the Table Design
button. A blank Table Design window displays. Here you enter field names, select
the data type, enter a description (if any), and set field properties for each field.
6. With the insertion point in the first Field Name box, type OrderNo
and press R. The first field name is entered, and the insertion point jumps
to the Data Type column. The default data type value, text, is displayed. You can
also use Tab to move between columns in the Table Design view.
7. Click the arrow in the Data Type box to display the list of available
data types, click AutoNumber, and then press R. AutoNumber
displays in the Data Type column and the insertion point moves to the Description
column. Descriptions are optional. They display on the status bar in the Datasheet
view of a table when that field is active. They are used to add clarifying
information to help someone entering or editing data. A description is not needed
for this field.
8. Press R to move to the second row of the Field Name column,
and type OrderDate; press R, type D to set the data type to
Date/Time; press R to move to the Description column and type
Date order was placed. The second field—Date—is added to the table
design as shown in Figure 11.9. The first letter of each data type acts like a shortcut
key. Pressing the first letter of a data type, as you did here, is a quick way to assign
data types when you are setting up a table.
UNIT 2: 886
Using Productivity Software
Field names
entered
Description
added
Data type set
FIGURE 11.9
9. Press R to move to the third line; type CustomerNo and press
R twice. The third field is entered and Text is accepted as the
data type. The CustomerNo field is still the active field.
10. In the Field Properties area at the bottom of the window, in the Field
Size box, select the displayed value and type 5. This limits the number of
characters that can be entered into this field to 5. Because customer numbers are
limited to five characters; limiting the field size helps ensure that correct data is
entered in this field.
11. Click the next available box in the Field Name column and continue
entering the field names, data types, and descriptions as shown in the
following table and then compare your results with Figure 11.10:
FIELD NAME
DATA TYPE
DESCRIPTION
Description
Text
Description of item
purchased
Amount
Currency
Amount of purchase
Installation
Yes/No
Installation required?
ContractorID
Text
Installer assigned to job
InstallationDate
Date/Time
Date installation is
scheduled
Project 11
Creating A Customized Database
UNIT 2: 887
Fields added
to table
FIGURE 11.10
12. Click anywhere in the OrderNo field to make it the active field, and
then on the Table Tools Design tab, in the Tools group, click the
Primary Key button. This makes the OrderNo field the primary key field for
this table. A small key displays in the field selector box next to the Active indicator
arrow. A primary key is used to designate a field that contains unique data for
each record. This field is used to help speed up sorting of data and to create a join
between tables. A common field is used to join tables so you can retrieve related
information from multiple tables. While a primary key is not required, it is strongly
recommended. In this table, the OrderNo field will contain unique data because it
is an AutoNumber field.
13. On the Quick Access toolbar, click the Save button. In the displayed
Save As dialog box, type Orders in the Table Name box, and then
click OK. The table is saved and the new name displays in the Table Design view
title bar. Leave this window open to continue to the next part of this lesson.
TO EXTEND YOUR KNOWLEDGE…
UNDERSTANDING FILE FORMATS
In previous versions of Microsoft Access, files were not backwardly compatible with
earlier versions of the software. With the introduction of Access 2000, file formats
became more stable and files created with Access 2000 can be opened and
manipulated with Access versions 2002, 2003 and 2007. However, files created with
Access versions 2002 or later have to be converted to be viewed with Access 2000. The
default file format for your computer may be set to Access 2000, Access 2002 – 2003,
or Access 2007. This affects the format of new Access files that you create. The default
file format can be changed in the Access Options dialog box on the Office menu. To
learn more about Access file formats, click the Help button and type converting
Access files in the Search box, press R and then click the link Convert a
UNIT 2: 888
Using Productivity Software
database to the Access 2007 file format, and the link Convert an Access 2007 database
to an earlier file format.
When you created the Orders table you set one property—the field size property—for
the CustomerNo field. You can set properties as soon as you set the data type for a field.
The data type determines the field properties that are available. It is also possible to set
field properties after a table is created. Properties can help ensure a consistent look when
the data is viewed. For example, text fields can be formatted to display in uppercase
letters, or formatted to display phone numbers, social security numbers, and dates with
appropriate parentheses, dashes, or slashes. This makes data entry faster because the
person entering the data does not have to type those characters. Setting a default value
for a field speeds up the input process by having the most common entry for a particular
field already inserted. If the Required Field property is set to Yes, it ensures that field is
not left empty. In the next part of this lesson, you set properties for a few of the fields in
the Orders table.
To Set Field Properties
1. With the Armstrong database open to the Orders Table Design view,
click anywhere on the OrderDate field to make it active; click the
Input Mask box in the Field Properties area. A small Build button
displays to the right of the Input Mask box. Input Masks are used to pre-format a
field to make it easier to enter data. For example, in a date field you have to type
slashes (/) to separate the month, day, and year. A date input mask pre-formats the
field with slashes.
2. Click the Build button to the right of the Input Mask box. The first
Input Mask Wizard dialog box opens. The options displayed are related to dates
because this is a date/time data-type field.
3. Select Short Date in the Input Mask list, click at the beginning of the
Try It box and type 09072008. When you type, you do not have to type the
slashes because the input mask formats the date to include them. You must enter
two digits for the month and day, so use a 0 in front of values 1 through 9.
Depending how the date is configured for your computer, you may be able to enter
the year in a two-digit format rather than the full four-digits.
4. Click Next. In the second Input Mask Wizard dialog box, you can modify the
input mask. For example, if you wanted the year to be a two-digit format or a fourdigit format, you could change the number of characters shown in the year
placeholder in the Input Mask Text box.
5. Click Finish. The dialog box closes and the input mask displays in the Input
Mask box in the Field Properties area as shown in Figure 11.11. Now when you
enter a date in this field you will not have to type the slash marks; they have been
pre-formatted for this field.
Project 11
Creating A Customized Database
UNIT 2: 889
OrderDate is the
active field
Short date input
mask
Build button
FIGURE 11.11
6. With the OrderDate field still the active field, click the Default Value
box and type Date( ) and then press R. This is a code that displays
the current date. Because most orders use the current date, you set the default
property for this field to display the current date automatically. The space between
the parentheses is removed by the program because it is not needed. When orders
are placed, the default date can be overridden by typing another date.
7. Click the InstallationDate field; repeat the procedure in steps 1
through 5 to add a short date input mask to this field; click Yes when
prompted to save the table. If a change is made to a table, you have to save
the table before the Input Mask Wizard will display. A short date input mask is
added to the InstallationDate field.
8. Click the CustomerNo field, and then, in the Format property box,
type >. The data you will enter in this field starts with a letter, followed by a dash
and numbers. The > (greater than) symbol is used to force any letters in this field
to display as uppercase.
9
Click the Required property box for the CustomerNo field; click the
list arrow in the Required box and select Yes . This property ensures that
the CustomerNo field will not be left empty.
10. Click the ContractorID field; change the Field Size property to 4 and
type > in the Format property box. This limits the field size to match the
size of the Contractor ID numbers that are used, and formats it to display any
letters as uppercase.
11. On the Quick Access toolbar, click the Save button to save the
changes you have made to the Orders table and then close the table.
The changes to the Orders table are saved. Leave the Armstrong database open
for the next lesson.
UNIT 2: 890
Using Productivity Software
TO EXTEND YOUR KNOWLEDGE…
CHANGING A TABLE AFTER IT CONTAINS DATA
You can make changes to a table at any time. However, if you change field properties,
or delete fields after data has been entered, warning boxes may display when you
attempt to save the changes. For example, if you change a field size to a smaller
number, Access recognizes the smaller field size and warns you that some data may be
lost. Therefore, it is important that you are certain that the smaller field size will not
be a problem. Another warning box displays if you add a required field property. The
addition of a required field invokes a "data integrity rules have changed" warning. If
one of the records does not contain the required data, Access cannot enforce the
required field property.
LESSO N 3: Creating Relationships and Enf orcing
Ref erential I nt egrity
Microsoft Office Access is a relational database , which means the data is divided into
several tables that can be related to each other by a common field. When this is done
correctly, it minimizes the amount of data that needs to be stored. In the Armstrong
database, the information about each contractor is entered once, rather than being
repeated for every order. The ContractorID field, which is designated as the primary key,
is used to uniquely identify each contractor. The ContractorID is also in the Orders table,
which identifies the contractor assigned to install the order. You create a relationship
between the Contractors table and the Orders table based on this common field.
A relationship is a join—connection— between two tables based on a common field
for the purpose of displaying or extracting information from connected records in both
tables. Relationships between tables are formalized in the Relationships window. Here
you define the relationship to ensure that a proper relationship is established before you
attempt to create forms or reports that use fields from more than one table. This is
particularly important in complex databases with many tables.
The most common type of relationship is the one-to-many relationship . In a oneto-many relationship, a record in one table may be related to many records in another
table. In the Armstrong database, each contractor has been assigned many orders. In
other words, each ContractorNo appears once in the Contractors table, but may appear
multiple times in the related Orders table.
A one-to-one relationship exists between two tables when a record in one table is
related to a single record in a second table. This is most often used when data is placed in
a separate table because access to the information is restricted.
In this lesson, you use the Relationships window to create a one-to-many relationship
between the two tables in the Armstrong database.
Project 11
Creating A Customized Database
UNIT 2: 891
To Create a Relationship
1. With the Armstrong database open, click the Database Tools tab, and
in the Show/Hide group click the Relationships button. The
Relationships window opens and the Show Table dialog box displays as shown in
Figure 11.12. The Show Table dialog box is used to add field list boxes to the
Relationships window. The Relationship Tools Design tab displays in the Ribbon.
Show Table button
Relationship Tools
Design tab
Relationship
window
Tables display in the
Show Table dialog
box
FIGURE 11.12
If you hav e problems...
If the Show Table dialog box does not open on your screen click the Show Table
button in the Relationships group on the Relationship Tools Design tab.
2. With the Contractors table already selected, hold down C and click
Orders . Click Add in the Show Table dialog box, and then close the
Show Table dialog box. Table field lists are added to the Relationship window.
To make it easier to see all of the fields listed, you can expand the field list boxes
by dragging the lower edge of the box.
3. Move the mouse pointer to the lower edge of the Contractors field
list box until you see a two-headed arrow, drag down to expand the
field list box so you can see all the fields.
4. In the same manner expand the Orders field list box until you see all
of the fields. ContractorID is in both field list boxes. In the Contractors
UNIT 2: 892
Using Productivity Software
table, the primary key indicator displays next to the field name. In the Orders
table, ContractorID does not display the primary key indicator because here it is
not the primary key field; rather it was included for the purpose of creating a join,
or relationship with the Contractors table. A field used for this purpose is known
as the foreign key field—the common field that is used to join with a primary key
field in another table.
5. In the Contractors field list, drag the ContractorID field from the
Contractors table and drop it on the ContractorID field in the Orders
table. The Edit Relationships dialog box displays as shown in Figure 11.13.
Access determines that this is a one-to-many relationship because the
ContractorID field used to create the join is a primary key field in only one of the
two tables.
Related table
displays on the
right
Primary table
displays on the
left
Relationship
identified
FIGURE 11.13
6. Click the Enforce Referential Integrity check box to select it.
Enforcing referential integrity helps you maintain the integrity of your database. It
prevents you from assigning an order to a nonexistent contractor. It also means
that you cannot drop a contractor from your database until all of their assigned
installations are reassigned to other contractors.
7. Click Create. The dialog box closes and a join line displays, as shown in Figure
11.14. The number 1 shows next to the one side of the relationship and the infinity
symbol, , shows next to the many side of the relationship. These symbols indicate
that referential integrity is enforced.
Project 11
Creating A Customized Database
UNIT 2: 893
One side of
relationship
Join line
Many side of
relationship
FIGURE 11.14
8. Close the Relationships window; choose Yes when you are prompted
to save the changes to the layout. Leave the Armstrong database
open for the next lesson.
TO EXTEND YOUR KNOWLEDGE…
REQUIREMENTS FOR CREATING RELATIONSHIPS
To create a relationship between two fields, not only must the fields contain the same
data, but they must also use the same data type. It is not necessary, however, that
related fields have the same name. If the primary field is an AutoNumber data type,
the related field must use the Number data type with the Field Size property set to
long integer to match the format of the AutoNumber data type.
LESSO N 4: A dding and Delet ing Records
Data can be entered into the database in three different ways: it can be imported from
another source, it can be captured from a Web site, or it can be entered using the
keyboard. With customized databases, this last method is the most common. Records can
be entered directly into a table or by using an Access form based on the table. You can
also delete records using either an Access form or directly in the table.
In this lesson, you enter data directly into the Orders table and then delete a record
from the Contractors table.
UNIT 2: 894
Using Productivity Software
To Add and Delete Records
1. On the Navigation Pane, double-click the Orders table, and then click
the Maximize button on the Orders title bar. The table datasheet fills the
window. The field names display across the top of the table, but no data has been
entered yet. The first field is an AutoNumber field, which means that the program
will assign a sequential number as soon as anything is entered into any fields in the
first row. The second field shows the current date because the default value
property was set to display the current date for this field.
2. Press F to move to the Date field; type 05122005 and press F. A
new date is entered, 1 appears in the OrderNo field and the insertion point moves
to the CustomerNo field. You did not have to type the slashes in the date field
because of the short date input mask property that was added to this field. The F
key is used to move across a row between fields. To move back a field, press
S + F. Notice that a pencil icon displays in the record selector box, which
indicates that this record is being edited.
3. Type t-241 in the CustomerNo field box and then press F; type
15x30 pool, press F, type 3500 and press F. Data is entered in the
next three fields. Notice that the t in the CustomerNo field is automatically changed to
an uppercase letter and that the amount in the currency field displays with a dollar
sign and two decimals. These changes are the result of the format property (>) set for
the CustomerNo field and the data type (currency) set for the Amount field.
4. Press s. A check mark is added to the box in the Installation field. Using
the spacebar is a quick way to choose Yes for this field. If you skip over this field
and leave it blank, it is interpreted as No. You can also click the box to select Yes.
5. Press F, type oh-3, press F, type 05242005. The first record is
added to the Orders table as shown in Figure 11.15. Notice that the ContractorID
data changes to uppercase letters and slashes display between the month, day, and
year in the InstallationDate field. Again, these formatting changes are the result of
the format property (>) set for the ContractorID field and the input mask set for
the InstallationDate field.
AutoNumber of first
record
New record
button
Pencil icon indicates
record is being edited
Record entered in
first row
New record
button
FIGURE 11.15
Project 11
Creating A Customized Database
UNIT 2: 895
6. Click the New (blank) record button on the Navigation bar. The
insertion point moves to the first field in next row in the table. There is a New
Record button on the navigation bar and on the Home tab, in the Records group
(refer to Figure 11.15). In this case, you could also have simply pressed R to
move from the first row of the table to the empty row in order to add a new record.
Records are added or updated to the database as soon as you move the insertion
point off the record that you are editing. So, in this example, the act of clicking the
New Record button also caused the first record to be recorded in the table.
7. Press F to move to the Date field, and follow the same procedure to
enter the next four records shown in the table below.
Ord erN o
2
3
4
5
Date
Cu st ome rNo Desc rip tio n
Amo un t In st allati o n Co nt ract o rID In st allati o nDat e
05/12/2005
C-182
8 person spa $4,000.00
Yes
OH-2
05/22/2005
05/13/2005
C-183
12x24 pool
$1,695.00
Yes
OH-2
05/25/2005
05/13/2005
Y-675
4 person spa $2,300.00
No
05/14/2005
S-737
15x24 pool
$2,450.00
Yes
MI-1
05/28/2005
Records are automatically saved as soon as you move to the next record. When
you close the Orders table, the last record you entered is saved. In Access, you do
not have to specifically save records; they are saved as soon as you close the table,
move to another record, or change views. If you want to specifically save a record,
on the Home tab, in the Records group you can click, Save, or press S +
R. Compare your results with Figure 11. 16.
Four more
records
added
FIGURE 11.16
8. Click the Office button, point to Print and then in the submenu click
Print Preview. On the Print Preview tab, in the Page Layout group
click the Landscape button. The Print Preview tab is used to control the
margins and the orientation of the page. These setting have to be chosen each time
you want to print. Notice that the name of the table and the date display in the
header, and the page number display in the footer area. These are automatically
set by Access. The name of the table is the only portion of the header and footer
area that you can control.
9. On the Print Preview tab, in the Print group, click Print and then
click OK.
10. Close the Print Preview window. On the right end of the Tab bar,
click the Close Window button to close the Orders table.
UNIT 2: 896
Using Productivity Software
11. Open the Contractors table. Click the record selector box to the left
of the sixth record, Hatfield's . The record is selected.
12. On the Table Tools Datasheet tab, in the Records group, click the
Delete button. A warning box displays advising you that if you delete this
record you will not be able to undo the operation as shown in Figure 11.17.
The record for
OH-1 Hatfield
is removed
from the table
Message box
warns that this
change will be
permanent
FIGURE 11.17
13. Click Yes. On the right end of the Tab bar, click the close button to
close the Contractors table. The record is removed from the table and only
the Navigation Pane displays the two tables for this database. Leave the
Armstrong database open for the next lesson.
TO EXTEND YOUR KNOWLEDGE…
EDITING RECORDS
Records in Access are edited using the same techniques as you use to edit text in
other Microsoft Office applications. Press B to remove characters to the left, or
press X to remove characters to the right. If you need to return to the previous
field, hold down S and then press F. While you hold down the S key,
you can continue to press F to move backward through the fields. You can also
click to place the insertion point in a field, and then drag to select the text you want
to replace. If you start to make a change and want to undo it, press E before you
leave the field, and the original data will display. 2can be used like a toggle button
to select the entire field or move the insertion point to the end of the field.
LESSO N 5: Creating a Form Using t he Form Wizard
Forms are used to enter data and to view records, usually one at a time. With a form,
more fields can be displayed on the screen at a time than when you view records in a table
datasheet. You can create an AutoForm , which displays all the fields of a table in a
column form layout. The Forms Wizard enables you to customize a form. With the Form
Project 11
Creating A Customized Database
UNIT 2: 897
Wizard you can list fields in an order that is different from the table, include only the
fields you need, select the layout, and apply a design.
In this lesson, you use the Form Wizard to create a customized form based on the
Contractors table.
To Create a Form Using the Form Wizard
1. With the Armstrong database open, in the Navigation Pane, click the
Objects List arrow and then click Forms. Forms displays as the active
object and no forms are shown for this database.
2. On the Ribbon click the Create tab. In the Forms group, click More
Forms and then click Form Wizard. The first Form Wizard dialog box
displays. Here you select the table or query you want to use for your form and the
fields to include. The order in which you select the fields determines the order the
fields will be displayed on the form. The Contractors table displays in the
Tables/Queries box and the fields from that table are listed in the Available Fields
box as shown in Figure 11.18.
Selected table
Selected Fields
box
Move arrow
Fields in the
contractor table
Move All fields
arrow
FIGURE 11.18
3. Click the Move All Fields arrow to place all of the fields from the
Contractors table in the Selected Fields box, and then click Next. The
second Form Wizard dialog box prompts you to choose a layout for the form.
4. Choose Columnar, if necessary. This will display each record in a columnar
format, as shown in the preview at the left side of the dialog box.
5. Click Next, and then click Office for the style. The third Form Wizard
dialog box is used to select a background style for the form. A preview of the
selected style displays on the left side of the dialog box.
6. Click Next and type Contractors Form. In the fourth (and final) Form
Wizard dialog box you name the form.
UNIT 2: 898
Using Productivity Software
7. Be sure that the Open the form to view or enter information option
button is selected and then click Finish. The completed form is saved and
displays the first record from the Contractors table as shown in Figure 11.19.
FIGURE 11.19
8. In the first record for ContactorID IN-1 , select Marci White in the
Contact Name field and type your name. This replaces the contact person
for REC Services in the Contractors table.
9. O n th e H o m e t a b, i n t h e V i ews gro u p cl i ck t h e V i e w b u tt o n arr o w
and then click Design View. The Form Design view displays as shown in
Figure 11.20. Here you can change the layout of the form by moving the controls,
resize or add controls, or change the design that you selected. A control is any
graphical object on a form or a report that is used to display data, perform an
action, or make a form or report easier to read. The Form Design Tools contextual
tabs—Design and Arrange—are available in the Ribbon. The tools shown here are
used to work with the design, format and layout of forms. Similar tools are
available when you work with a report design.
Project 11
Creating A Customized Database
UNIT 2: 899
Form
Design
Tools tabs
Controls
that display
labels
Controls
that display
data
FIGURE 11.20
10. On the Contractors Form title bar, click the Close button to close the
form. The form closes and the Contractors Form is listed on the Navigation Pane.
LESSO N 6: Creating a Report Using t he Report W izard
Printed reports are useful for sharing data in a meeting, or to show information at a point
in time. Reports can also be used onscreen to summarize, group, and list data from
selected fields. A report gives you the flexibility to print the records and fields you select.
You can also sort and group the records in a number of different ways. The Access
Report Wizard helps you create a customized report that includes the fields you want,
grouped and sorted in the manner you select. Reports, like forms, can be modified once
they have been created.
In this task, you create a contact list report based on the Contractors table. It will be
grouped by state and sorted by the contractors' names
To Create a Report Using the Report Wizard
1. With the Armstrong database open, in the Navigation Pane, click the
Objects List arrow and then click Reports. No reports are listed for this
database.
2. Click the Create tab. In the Reports group, click the Report Wizard
button. The first page in the Report Wizard opens and the Contractors table
displays in the Tables/Queries box with its fields displayed in the Available Fields
list box. Using the Report Wizard is similar to using the Form Wizard. You select
the fields you want to include and then add them to the Selected Fields box.
3. Doub le -cli ck on ea ch of t he fol lo wi ng f iel ds t o ad d th em to t he
Sel e cte d Fi e lds b ox: Co ntr actorNam e, Con tact Nam e,
Stat eOrPr ovin ce, Pho neNum ber, F axNumber . Five fields move to the
UNIT 2: 900
Using Productivity Software
Selected Fields box as shown in Figure 11.21. A field is moved by double-clicking
on the desired field or by selecting the field and clicking the Move arrow.
Contractors
table selected
Fields added
FIGURE 11.21
4. Click Next. In the box on the left of the screen, click the
StateOrProvince field and then click the Move arrow. The second
Report Wizard dialog box is used to group data. This report will be grouped by the
StateOrProvince field. This mean that all of the records for the same state or
province will be displayed together as a group with the specific state or province
name displayed as a heading at the beginning of those records and the other fields
listed underneath, as shown in Figure 11.22. In a report, you may want to organize
records by one or more fields.
Records grouped by
StateOrProvince
Field names
entered
Other fields include in
report
FIGURE 11.22
Project 11
Creating A Customized Database
UNIT 2: 901
5. Click Next; in the third Report Wizard dialog box click the list arrow
at the right end of box 1 and select ContractorName . You can sort the
data in a report on up to four fields. The button to the right of the sort box
indicates the sort order is ascending—A to Z. Clicking this button would change
the sort order to descending—Z to A.
6. Cl i ck N e x t; in t h e f o ur t h R e p or t W i zar d d i al o g b o x s el ect th e
S t ep p ed l ay o ut an d t h e P or tr ait o ri e n ta t i o n , i f n eces s ar y. This dialog
box is used to select the report’s layout and orientation—portrait or landscape.
7. Click Next; in the fifth Report Wizard dialog box choose Office for
the report design. The design you selected is shown in the preview area.
8. Click Next; in the sixth and final Report Wizard dialog box type
Contact List as the report name.
9. Click Finish. On the Quick Access toolbar click the Save button to
save the report. The Contract List report displays in Print Preview as shown in
Figure 11.23.
Report is grouped by
StateOrProvince field
Records sorted
by Contractor
under each state
FIGURE 11.23
10. On the Print Preview tab, in the Print group click the Print button
and then click OK. Close the Contact List report. On the Contract
List title bar, click the Close button.
11. Click the Office button and then click Close Database. Close Access.
SUMMAR Y
In this project, you were introduced to Access, the Microsoft Office relational database
program that manages collections of related data. You learned the function of the four
main objects in Access: tables that store the data; queries, which are used to sort, search,
and limit the data; forms, which are used to enter or edit records; and reports, which
summarize information in a meaningful manner. You examined the manner in which data
UNIT 2: 902
Using Productivity Software
is displayed in each of these four objects and then looked at the Design view of tables and
queries. You created a table in Design view, created a relationship between two tables, and
added records. You then created a form and a report using Access wizards.
KEY TERMS
AutoForm
Controls
data type
database
Datasheet view
Design view
field
field list
foreign key field
Form view
forms
join
macros
CHECKIN G
pages
primary key field
properties
queries
records
referential
integrity
relational
database
relationship
reports
tables
Microsoft Visual
Basic for
Applications
(VBA)
modules
Navigation Pane
Object Linking
and Embedding
(OLE)
objects
one-to-many
relationship
one-to-one
relationship
CONCEPTS
AN D
TERMS
SCREEN ID
Label each element of the screen shown in Figure 11.24.
4
3
2
5
1
10
9
8
7
6
Project 11
FIGURE 11.24
Creating A Customized Database
UNIT 2: 903
_____ A. Delete record
_____ B. Field name
_____ C. Navigation bar
_____ D. Navigation
Pane
_____ E. Next Record
button
_____ F. New Record
button
_____ G. Record
_____ H. Select record
box
_____ I. Shutter Bar
Open/Close
_____ J. Switch to
Design View
MULTIPLE CHOICE
Circle the letter of the correct answer for each of the following.
1.
Records in an Access database are
stored in _______________ .[L1]
a.
b.
c.
d.
2.
b.
c.
d.
3.
control the order of the fields
you want to include
select a design
select a layout
All of the above
a.
b.
c.
d.
6.
d.
7.
l
S+F
F
R
store records
sort records
organize and present
information
edit records
When creating an Access table, the
default data type is
______________.[L2]
a.
b.
c.
d.
text
AutoNumber
memo
number
The most common type of
relationship in Access is
__________________.[L3]
To delete a record from a table,
click the record selector box to the
left of the record and then
_________________. [L3],
a.
b.
c.
d.
a.
b.
c.
d.
one-to-many
many-to-many
one-to-one
many-to-one
UNIT 2: 904
Using Productivity Software
8.
view all the records at once
enter or edit records
store records
sort records
Reports are used primarily to
_________________.[L1],[L6]
a.
b.
c.
To move from right to left in a
Datasheet view of a table press
_________________. [L4]
a.
b.
c.
d.
4.
forms
reports
tables
All of the above
When you create a form with the
Form Wizard you can
______________. [L5]
a.
5.
Forms are used primarily to
____________________.[L1],[L5]
press X
press E
click the Delete record button
a and c but not b
9.
To format a Date/Time field to
automatically display slashes to
separate month, day, and year set
the _____________________
property. [L2]
a.
b.
c.
d.
Field Size
Format
Input Mask
Required
10.
To create a relationship between
two tables both tables
must_____________.[L3]
a.
b.
c.
d.
have a field in common
use the same name for their
common field
sort records in the same order
All of the above
DISC USSION
1.
Discuss the purpose of each of the four main database objects: tables, queries,
forms, and reports. Include in your discussion an example that illustrates how each
of these objects is used. [L1]—[L2],[L5],[L6]
2.
In a group, make a list of the databases in which your name is likely to appear.
Consider your activities, where you live, how you pay your bills, your mode of
transportation. Thinking about all of these databases, describe the communication
you receive from these databases and how those documents compare to database
reports. [L1], [L6]
3.
States issue licenses to cars and drivers. List databases needed to track this kind of
information. Consider insurance records for cars. List the fields that would be
needed to track data related to car insurance. [L1]—[L2]
SKILL DRILL
Skill Drill exercises reinforce project skills. Each skill reinforced is the same, or nearly
the same, as a skill presented in the project. Detailed instructions are provided in a
step-by-step format.
Work through Skill Drill exercise 1 and 2, and then you may complete the
remaining Skill Drill exercises in any order. All of these exercises can be completed
with Microsoft Office XP or later versions. Instructions throughout the exercises are
based on the Windows XP operating system, running Microsoft Office 2007.
1. Exploring a Database Table and Changing Field Properties
Armstrong Pool, Spa, and Sauna Company needs to set up a database to track the
inventory of the pool parts that they stock for their stores. The database has been
started and the Suppliers table has already been created. You will open the
database and create copy to use. You will examine the existing Suppliers table and
change the field size property for some fields.
Project 11
Creating A Customized Database
UNIT 2: 905
1.
2.
3.
4.
5.
6.
Open AC_1103 from the Student folder. From the Office button, point to Save
As and then click Office 2002-20 03. In the File name type Armstrong
Suppliers, and then navigate to the folder where you are saving your files.
Click Save.
On the Security Warning bar click the Options button and then click Enable
this content and click OK.
In the Navigation Pane, under Tables, double-click the Suppliers table. Four
records are displayed.
On the Home tab, in the Views group, click the View button.
Note that SuppliersID is the primary key field and it has an AutoNumber data
type. All of the other fields are text data types.
Click on each field, examine the properties, and then change the Field Size
property as shown below:
Field
Field Size
ContactName
30
Address
50
City
20
State
2
PostalCode
5
Phone
20
PaymentTerms 10
7.
Click Save on the Quick Access toolbar and click Yes in the warning box.
8.
Close the table, but leave the Armstrong Suppliers database open to continue
with the next Skill Drill exercise.
2. Creating a Table Using Design View and Adding Records
A table to track the parts that are stocked by Armstrong, Pool, Spa, and Sauna
Company needs to be added to the Armstrong Suppliers database, and records
need to be added.
1.
With the Armstrong Suppliers database open, click the Create tab, and in
the Tables group click the Table Design button.
2.
Type the field names, set the data type, type the description, and set the field
size property as shown below:
UNIT 2: 906
Using Productivity Software
FIELD NAME
DATA TYPE DESCRIPTION
FIELD
SIZE
PartName
Text
Name of the part as shown
in the manual
20
PartNumber
Text
Manufacturer's part
number
12
Description
Text
Cost
Currency Wholesale cost
Price
Currency Retail price in stores
Stock
Number
Quantity in the warehouse
3.
Select the PartNumber field and on the Table Tools Design tab, in the Tools
group, click the Primary Key button to set this field as the primary key.
4.
On the Quick Access toolbar, click the Save button and name the table as
Pool Parts Inventory and click OK.
5.
In the Views group, click the Vi ew button to move to Datasheet view.
6.
Enter the following five records in this table.
PARTNAME
PARTNUMBER
DESCRIPTION
COST
PRICE
STOCK
6' Top Rail
1833X06TR
Curved top
rail
Straight top
rail
4' Flat
18x33 liner
4' to 9'
18x33 liner
Aluminum
18x33 wall
$12.50
$25.00
31
$22.00
$48.00
15
12' Top Rail 1833X12TRS
Flat Liner
1833X04L
Hopper Liner 1833X0409L
18x33 Wall
1833X04W
$120.00 $480.00
4
$150.00 $675.00
3
$450.00 $1,050.00 2
7.
Close the Pool Parts Inventory table.
8.
Open the Suppliers table. Click the record selector box next to SuppliersID 1
and then press X to delete this record. In the warning box click Yes to
confirm that you want to delete the first record. Close the table. Leave the
Armstrong_Suppliers database open to complete the remaining exercises.
Project 11
Creating A Customized Database
UNIT 2: 907
3. Creating a Relationship
To create a relationship between tables, the tables must have a field in common,
with one of the fields being a primary key. As they are currently created, the
Suppliers table and the Pool Parts Inventory table do not have any fields in
common. You will add the SuppliersID field to the Pool Parts Inventory table and
then create a one-to-many relationship.
1.
Open the Armstrong_Suppliers database if necessary.
2.
Open the Pool Parts Inventory table and then on the Home tab, in the
Views group click the View button.
3.
Click in the next empty Field Name box, type SuppliersID, choose
Number as the data type and then press R. Notice that Long Integer is
the default Field Size property. This is necessary to create a join with the
primary key field, SuppliersID, in the Suppliers table where this field is an
AutoNumber data type.
4.
Click the View button, and then click Yes when prompted to save the
changes.
5.
In the SuppliersID column, enter the following numbers for the 5 records: 2,
2, 4,3,3. Hint: Use the bto move to each subsequent record.
6.
Close the Pool Parts Inventory table. Click the Database Tools tab, and in
the Show/Hide group click the Relationships button.
7.
In the Show Table dialog box, click Add, and then click the Suppliers table
and click Add. Close the Show Table dialog box. The field lists for both tables
are added to the Relationships window.
8.
Drag the bottom of each field list box to expand the boxes until you can see all
of the field names.
9.
Drag the SuppliersID field from the Suppliers field list and drop it on the
SuppliersID field in the Pool Parts Inventory field list.
10. In the Edit Relationships dialog box, click Enforce Referential Integrity
and then click Create.
11. Close the Relationships window and then click Yes when prompted to save
the changes.
4. Creating a Form
Next you will create a form to add new suppliers to the database.
1.
With the Armstrong Suppliers database open, click the Object list arrow on
the Navigation Pane, and then click Forms.
2.
Click the Create tab, and in the Forms group click More Forms and then
click Form Wizard.
UNIT 2: 908
Using Productivity Software
3.
If necessary, click the Tables/Query list arrow and select Table: Suppliers
from the displayed list. Add all the fields, in the order they appear, to the
Selected Fields box.
4.
Scroll to the top of the list in the Selected Fields box, click the SuppliersID
field and then click the Remove arrow to return this field to the Available
Fields list.
5.
Click Next. Choose the Columnar layout.
6.
Click Next. Choose the Trek style.
7.
Click Next and name the form Suppliers Form.
8.
Click Finish.
9.
Click the New Record button on the Navigation bar and enter the following
record using the form you just created. Be sure to enter your name for the
Contact Name:
Distributor
Contact
Name
Address
City
State Postal
Code
Bluewater Student 1200
Troy MI
Spa Co.
Name
Eisenhower
Phone
Payment
Terms
48098 (313) 30
555- Day
1021
10. Close the form.
5. Creating a Report
This database will also need an inventory report, so you can see how much
inventory is in stock at any one time. In this Skill Drill exercise you create a report
based on the Pool Parts Inventory table.
1.
With the Armstrong Suppliers database open, click the Create tab, and in
the Reports group, click Report Wizard.
2.
Select Table: Pool Parts Inventory in the Tables/Queries list box. Add all of
the fields to the Selected Fields box except SuppliersID, and then click Next.
3.
In the second dialog box, do not add any grouping levels. Click Next.
4.
In the third dialog box, sort in ascending order by Part Name. Click N ext.
5.
In the fourth dialog box, select a Tabular report printed in the Portrait
orientation. If Tabular is not available, click Stepped. Click Next.
6.
In the fifth dialog box, select the Trek style. Click Next.
7.
In the last dialog box, name the report Inventory Report. Click
Finish.
8.
Print the results (optional). Close the report. Close the database.
Project 11
Creating A Customized Database
UNIT 2: 909
CHALLENGE
Challenge exercises expand on or are somewhat related to skills presented in the
lessons. Each exercise provides a brief narrative introduction, followed by instructions
in a numbered-step format that are not as detailed as those in the Skill Drill section.
The Challenge exercises are independent and can be completed in any order.
1. Creating a Database and Creating a Table Using the Table Wizard
You have created a table in Design view in an existing database, and forms and
reports using a wizard. Tables can also be created using a wizard that enables you
to pick fields for different types of tables.
The Alumni Travel Club wants to create a database to track members and trips
that are offered. With your newfound Microsoft Office Access skills you offer to
create the database and set up a members table.
1. Start Microsoft Office Access. On the Getting Started with Microsoft
Office Access window, under New Blank Database click Blank database.
2. On the right side in the File Name box type Travel Club and then click
the Browse button and navigate to the folder where you are saving your
student work and click OK. Then click Create. A blank table datasheet
displays. You can create a table by entering data in the Add New Field box.
You can also name the fields in the Datasheet view.
3. The Add New Field box is active. On the Tabl e Tools Datasheet tab, in
the Fields & Columns group click Rename to make the Field Name area
active. Type Title and then press R. The first field name is added and
the next field name box becomes active.
4. Continue in this manner to add field names to this table as follows:
FirstName, LastName, BillingAddress, City,
StateOrProvince, PostalCode, PhoneNumber,
EmailAddress.
5. On the Quick Access toolbar click the Save button and name this table
Customers.
6. Click the View button and examine the design of the table and the data type
fields that have been selected.
7. Click the FirstName field. Click the Field Size property and change the field
size to 5. Click each of the other fields and change the field sizes as follows:
FirstName, LastName, and City to 20, BillingAddress and EmailAddress to
50, StateOrProvince to 3, PostalCode and PhoneNumber to 15.
8. Save the changes, click the View button, and add your name, address, and
other information to this table to test it.
9. Close the table and close the Travel Club database.
UNIT 2: 910
Using Productivity Software
2. Examining a Database Table, Importing Data from Excel, Creating a
Relationship
Database records that have been entered in an Excel worksheet can be imported
into a Microsoft Office Access database. The Alumni Travel club has tracked
information about the payments received from its members for upcoming trips.
They want to add this information to the new database you are helping to create.
Rather than reentering all of the records, you will use the Import command to
bring these records into the Alumni Travel Club database.
1. Open AC_1104. Save this file in your folder with the name Alumni
Travel Club. Enable the content.
2. Open the Members table and examine the fields used in this table. Change to
the Design view and identify the primary key for this table. Close the table.
3. On the Ribbon click the External Data tab. In the Import group click
Excel. The Get External Data – Excel Spreadsheet dialog box opens.
4. In the displayed dialog box, click the Browse button and navigate the student
folder for this project, and select AC_1105, which is a Microsoft Office Excel
file. Click Open.
5. In the Get External Data – Excel Spreadsheet dialog box, be sure Import the
source data into a new table in the current database is selected and then click OK.
6. The Import Spreadsheet Wizard dialog box displays. Be sure the Show
Worksheets option button is selected and Transactions displays in the box to
the right, and then click Next .
7. In the next Import Spreadsheet Wizard dialog box, verify that the First Row
Contains Column Headings is checked, and then click Next. No changes are
required in the fourth step, so click Next again.
8. In the fifth dialog box, click Choose my own primary key, and make sure that
Transaction # is displayed in the list box.
9. Click Next. In the last dialog box, make sure Transactions displays in the
Import to Table box. Click Finish and then click Close.
10. Open the Transactions table, examine the data, and then close the table.
11. On the Database Tools tab, click the Relationships button. Add both
tables, and expand the field list boxes. Create a one-to-many relationship based
on the Member ID field with referential integrity enforced.
12. On the Relationship Tools Design tab, in the Tools group, click
Relationship Report to create a relationships report and then print it
(optional). On the Quick Access toolbar click the Save and save the
relationships report with the default name. Close the report, the Relationships
window, and then close the Alumni Travel Club database.
3. Creating an AutoForm and an AutoReport
A friend has recorded data about geographic features in an Access database. You
offer to show him how to create a form to make data entry easier, and how to create a
simple report.
Project 11
Creating A Customized Database
UNIT 2: 911
1. Open AC_1106. Save this file in your folder with the name Alaska, and then
enable the content. This database has one table named Geography.
2. In the Navigation Pane, click the Geography table to select it, but do not
open it. On the Create tab, in the Forms group click the Form button. A
form is created and displays on your screen.
3. Save the form with the name Geography Input. View the form and click
the record selector bar to the left of the data. From the Office menu, click
Print. In the displayed Print dialog box, choose Selected Record(s), and then
click OK to print 1 record (optional). Close the Form.
4. With the Geography table still selected, on the Create tab, in the Reports
group click the Report button. A report is created and displays on your
screen. Examine the report and notice the placement of fields
5. Click the Report Layout Tools Page Setup tab, and in the Page Layout
group click Landscape. Then click the Size button and change the size to
Legal 8.5" x 14"
6. View the report again to see that the width of the data for each record prints
across one page. Save the report with the name Geography. Close the
report and close the Alaska database.
DISC OVERY ZONE
Discovery Zone exercises require advanced knowledge of topics presented in
Essentials lessons, application of skills from multiple lessons, or self-directed learning
of new skills. Each exercise is independent of the others, so you may complete the
exercises in any order.
1. Using the Database Wizard to Create a Database
While you will probably create most of your databases from scratch, or use one
that someone else has created, you can gain insight into the organization of
complex databases by looking at a database created with a template. Microsoft
Office Access offers a number of database templates that can be helpful in
designing a database, especially if you are uncertain of all of the fields you might
need to consider.
To create a database to manage the trips sponsored by the Alumni Travel Club by
using one of the Microsoft Office Access templates, follow these steps:
1. Start Microsoft Office Access. On the Getting Started with Microsoft
Office Access window, under Featured Online Templates click Events. On
the right, in the File Name box type Trips. Click the Browse button and
navigate to the folder where you are saving your files, and then click OK.
2. Click Download. Review the information in the Access Help window about
using the Events template, and then close the Access Help window.
UNIT 2: 912
Using Productivity Software
3. Enable the content. The Navigation Pane is collapsed to reduce the amount of
space that it uses. At the top of the Navigation Pane, click the Shutter Bar
Open/Close Button to expand the Navigation Pane.
4. At the top of the Events Navigation bar, click the list arrow and notice that
Events Navigation is selected. Click Object Type to display all of the objects
that have been created for this database.
5. Open different objects to see how they look. No data has been entered in this
database, so only the form layout and fields display.
6. In the Navigation Pane, under Forms double-click Events Detail to display
this form. Enter information about a trip you would like to take. Use the
calendar buttons to help you select dates. Click Save and New when you are
done, and then close the form.
7. In the Navigation Pane, under Tables, double-click Events to see that the
information you enter has been added to this table. Close the table.
8. Under Reports, open the Events Detail report to see the data you entered
displayed in a report.
9. Close all of the objects that you opened and then close the database.
2. Using Help to Understand Database Design
Good database design is the key to success. The phrase "garbage in, garbage out"
was coined in reference to databases—meaning that a database is only as useful as
the integrity and accuracy of the data that has been entered. Making sure you have
a useful database starts with the design process.
In this Discovery Zone exercise you will examine the design tips that are provided
by Microsoft Office Access Help.
1. Start Microsoft Office Access. Click the Help button, and in the Search
box type designing databases. Press R.
2. Click Database design basics from the topics listed. The information that is
displayed includes several related topics that are collapsed. Click the first topic
listed—Some database terms to know—and all of the topics will expand.
3. If you prefer, click the Print button in the Help window and read the printout
on this topic.
4. Write a list of 10 questions that should be asked when gathering information
about any new database. Turn in the list to your instructor.
Project 11
Creating A Customized Database
UNIT 2: 913