Académique Documents
Professionnel Documents
Culture Documents
STLINENT' WORKtsOOK
ACCESS 2
FORWINDOWS
Andcrson Soft-'feach 289-,+50
,ri'...'' -,' l
:i: . ::"." .i, "
nh. - i-rl
''4. :
li : .ri {il!.ii.r:.ii,
..
.:j!.. .1i ..i..
hiame
Table of
Contents
Getting Started.. ........... L
continued...
Tiile #289-450
Table of Contents continued...
Lesson 3
continued...
Title #289-450
11
Table of Contents continued..,
continued...
Title #289-450 111
Table of Contents continued...
continued...
Title #289-450
IV
Table of Contents continued...
continued...
Title #289-450
Table of Contents continued...
continued...
Title #289-450
vl
Table of Contents continued...
continued...
Tirle #289-450 vll
Table of Contents continued...
continued...
Tifle #289-450
vlll
Table of Contents continued...
continued...
Title #289-450
ix
Table of Contents continued...
;:H::9:lTlllil
19-1
::: : ::
::: ::: :: :::::
Graphics
Copying and Pasting
:: iZZ
.........261
Wizard
I9-2 Using the Graph ...................263
1,9-3 Viewing aGraph .............265
............... ...........267
I9-4 Adding Data Labels
Additional Exercises ................... 268
continued...
Title #289-450
Table of Contents continued..,
continued...
Title #289-450 x1
Table of Contents continued...
continued...
Title #289-450
xll
Table of Contents continued...
Congratulations .......325
Glossary .....327
Index ..........331
xllt
Exploring Access
Lesson One
This lesson also introduces you to the six objects . Identiff Access Objects
that make up an Access database. . Get Help
Finally, you'll use the Help feature to look up . Close and Exit Access
information about the Access program. Then, you
will close the database and exit the Access program.
Tiile #289-450
Lesson One Before You Sturt
If practicing the skills in this lesson without the CD-ROM, perform steps 5 and 6 only. The practice
files must be installed on your hard disk in a subdirectory called C:\AST. If they are not, you will
need to install them before continuing. Refer to the section titled "Taking this Course Without the
CD-ROM" on page 4 in the Getting Started section for instructions on how to do this.
2 Choose:
Choose:
Notice: The first skill in the lesson plan begins playing in the "Try
It" mode-
Note: lf you've just completed the "Show Me" segment of a skill,
you can switch to the "Try lt" mode by choosing the START button
under the words "Try lt" in the enlarged Playback Controlwindow.
Tirle #289-450
Lesson One skiu 1-1
Database Concepts
In this skill, you will become familiar with database concepts.
Paper Database: Any database, such as a telephone book, that exists on paper.
Electronic Electronic databases store data electronically, such as a file on your computer, and
Database: allow you to manage data easily. For example, you can store very large amounts of
information and you can quickly extract and rearrange that data.
Relational A relational database allows you to organize and analyze data stored in related
Database: tables. It stores and retrieves information according to relationships you define.
Access: Access is an electronic relational database system used to collect, retrieve, and
present data. Access allows you to work with data in several formats including
tables, customized entry forms, reports, and queries.
Table: A table is a collection of data about a particular subject. This data is presented in
columns (called fields) and rows (called records). All the data in a table should
describe the subject of the table. For example, one table might store employee
information, while another table would contain customer information.
Field: A field is a category of information. It could be employee last names, street address-
es, or phone numbers.
Record: A record is a collection of information about one person, thing, or event. It could be
all the information about one employee, or details about one product.
Cell: The intersection of a column and row is called a cell. Cells contain the individual
values in a table.
Field
Record
(Cont.)
Tirle #289-450
Lesson One skilt 1-1
Database Concepts
(Continued)
Forms: Forms provide a convenient layout for entering, changing, and viewing records in a
database.
Queries and A query is a question you ask about the data in your database such as "Which employees
Dynasets: work in the eastern sales region?" The data that answers the question can be from one or
several tables. The query brings the information together in a set of records called a
ttdynaset.tt
SourceTable
Dynaset
EMP38
EMP83
.-E-lt.P_-89
EMP31
Etdff"g:
EMP14
Tiile #289-450
10
Lesson One skill 1-2
Starting Access
To view and work with an Access database, you must first start the Access program.
Microsoft
0ffice
W
Microsoft
Access
Title #289-450
t1
Lesson One skiu 1-3
To open more than one Access database file, you must run another copy of the Access program.
By mnning muftiple copies of Aicess, you can: open as many database files as your computer's
tl...stofEr
Title #289-450
t2
Lesson One skiu 1-4
In this skill, you will use the diagram below to familiarize yourself with the different parts of the
Access program window.
Control-menu box
(Cont.)
Tirle #289-450
t3
Lesson One skiu 1-4
The six major objects that make up an Access database are tables, queries,forms, reports, macros,
and modules. Each object group is organized in the Database window, as shown below. To switch
between object groups, click on the group's object button.
Object buftons
(Cont.)
Title #289-450 t4
Lesson One skiu 1-4
Techniques
Titl€ #289-450
t5
In Pructice: Gettins H,
When you have questions concerning the commands and topics in Access, you can receive help from
the Help button on the toolbar, or the Help menu on the menu bar. Clicking on the Help button
allows you to select the part of the screen, menu item, or the button you want to learn about. When
you select Help on the menu bar, you can choose from a list of Help commands that let you access
information in different ways. There's even a feafure called Cue Cards that will walk you through
tasks as you work.
In this skill, you will practice using the Access Help feature.
I Choose: t
(Cont.)
Tiile #289-450 16
In Practice: Gettins HeI,
t7 Tiile #289-450
Lesson One skilt 1-5
When you exit Access, you will return to the Windows desktop.
In this skill, you will close the W&A-l.MDB database and exit Access.
3 Choose: Exit
Notice: You have exited the Access program.
Title #289-450
18
Lesson One
Additional Exercises
After performing the skills in this lesson, you may want some additional practice. Below are some sugges-
tions for activities you can try on your computer, along with some questions to check your comprehension of
the material covered in the lesson.
ACTIVITIES TO TRY:
1. Start the Access program and open the W&A-1.MDB database.
2. Identify the following parts of the screen: Toolbar, Status bar, Object buttons.
4. Practice using the Help button to access help on various features of Access.
OUESTIONS:
2. What are some examples of forms that are currently used in your workplace?
Title #289-450
19
Working in Tables
Lesson Two
23 Tiile #289-450
Lesson Two Before You Start
To practice the skills in this lesson without the CD-ROM, perform steps 5 through 8 only.
4 Choose:
Notice: The first skill in the lesson plan begins playing in the "Try
It" mode.
Note: lf you've just completed the "Show Me" segment of a skill,
you can switch to the "Try lt" mode by choosing the START
button under the words "Try lt" in the enlarged Playback Control
window.
Title #289-450
24
Lesson Two skill 2-1
Opening a Table
To work with the data in a table, you must open the table. When you first open a table, it is dis-
played in Datasheet view. Datasheet view allows you to enter, edit, and remove records from your
tables.
Title #289-450
25
Lesson Two skill 2-2
The information in a table is divided into fields and records. To work with this information, you will need
to move from one field to the next within a record, and from one record to the next within a table.
In this skili, you will examine the Employees table in Datasheet view and practice moving through
the records in that table.
The Status bar reads The Record Number box and navigation buttons are located at
"Datasheet View." the bottom of the screen. This table contains 80 records.
(Cont.)
Title #289-450
26
Lesson Two skiu 2-2
Field Selector
(Cont.)
Title #289-450
27
Lesson Two skilt 2-2
Tips and
Techniques Records, Go To; fo move to the f,rst, last, next, previous, or new record.
End key: To move to the last field of a record.
Home key: To move to the first cell in a record,
and press the End or Home key: To move to the beginning or end of a cell.
Click in a cell::::::::::::::::::::::::::::::::::
Ctrl+End key: To move to the last field of the last record.
Ctrl+Home key: To move to ine grst field of the first record,
Click in a cetl and niess,,Ciil+Home or Ctd+End: T0.*o+e,td fie..Hgi-nnine br,.end:of,a cell,
Title #289-450 28
Lesson Two skiil 2-3
Editing Records
Making changes tothe records in a table is easy. You can select the record and retype the entry, or
edit any part of the cell's contents.
When you deselect the record, your changes are automatically saved.
Step by Step '1 Double-click: in the Title field of record 6 (to select Developer)
2 Type: Trainer
Notice: ffre ffi
symbot appears in the record selector. This
indicates that record 6 is being modified, but the changes have not
been saved.
5 Type: Ave.
6 Click: bnywhere outside record 2
Notice: The change is made and the W symOol is removed from
the record selector. Your changes are automatically saved when
you deselect the record.
7 Scroll: right until you can see the Notes field (use the
horizontal scroll bar) ffi
8 Click: in the Notes field of record 7
(it reads "Martha has been...")
I Press: tcshiiil + E] (the Zoom key)
Notice: The Zoom window appears. You can now see the entire
note.
Title #289-450
29
Lesson Two skiu 2-4
Adding Records
To add new records te an existing table, you simply move to the end of the table and add the record.
Each table has a blank record at the end of the table. To move to the blank record at the end of the
table, use the New button on the toolbar.
2 Type: EMP98
Note: When you entered the phone number and date, a format
called an "input mask" appeared. This is designed to automate
data entry. You can learn how to add an input mask in skill 9-3
of this course.
Press: tkFGl
Notice: You are moved to a new, blank record.
Tips and You can also choose Records. Dak Entry to open a data entry sheet for entering records. A data
entry sheet allows you to enter records wiihout viewing all the existing records. Afler entering
Techniques
records using the data entry shee! you can click the Show All Records button ffi to view all
records^ You can close the Data Entry table without showing all records. Access will
automatically update the table and save your changes.
If the Data Entry command is not availabte, choose Records, Allow Editing.
Choosing Show AII Records sorts the table according to your current sort specifications. Ifyou
have not set any sort specifications, the table is sorted on the Primary key.
Title #289-450
30
Lesson Two skiu 2-s
Deleting Records
Eventually, you will need to delete records. For example, if an employee leaves the company, you
might choose to remove their record from the Employees table.
4 Press: tEnter=l
Notice: The record is removed from the table.
Tips and You can also choose Edit, Cut to remove records. Uping the Cut command stores a copy of the
record in the computer's clipboard. Using the Delete key removes the record permanently.
Techniques
To seieei ail the:mco-l&,,in a:::ttb-1b,::,alick::on:tfte::Sbl€ct:rAll:.Rebbfdsirbufion;
in..theuppei;left,,comei.oftthe tei
Title #289-450
31
Lesson Two skill 2-6
Closing a Table
When you've finished working with a table, it's a good idea to close it. Having too many objects
open at one time can use up your computer's available memory. This can make working in Access
less efficient.
You learned that Access automatically saves records when you deselect them. Therefore, you can
close your table without saving, and any changes you've made to your records will be saved.
Title #289-450
32
In Practice: Previewins and Printins a Tuble
You can send a table to the printer by choosing the Print command or clicking on the Print button.
You can also preview your work before sending it to the printer. This allows you to determine how
your table will look on the printed page.
If you don't like the way your table looks in the Preview window, you can change the print settings in
the Print Settings dialog box. For example, you can change the page orientation of the printed table,
adjust margins, and select a printer.
In this skill, you will preview the table, change print settings, and print the table.
Examine: the Page Number box (at the bottom of the screen)
Notice: ttreadsffi
Click:
'ffi the Next Page button
Notice: The last five fields of this table overflow onto page 2.
O Pottrait
O Land*cape
(Cont.)
Title #289-450
JJ
In Pructice: Previewins and Printing a Thble
Step by Step
(continued)
sChoose:l*ffi l-ilffi
S-j-j-$.$$i'iiri$$
Changing Margins:
14 Press: tEnter=l
Notice: The Customers table now fits on one page.
16 Choose: L l
Notice: The table is senf to the printer.
17 Click: ffi tne Close Window bufton (to close the Preview
window)
Notice: You have returned to the table.
Tips and You can also print a taUte by selecting it in the Daiabase window, and clicking the Print button.
Techniques When previewing a table, you can use the Zoom button to get a closer view of your data. You
.un tfr"n use the scroli butt to view different areas oithe page'
You can ulro ouiput a copy of the table to u Mi.roroft Word fiIe, an Excel file, o, u tnti"ro*oft
Title #289-450 34
Lesson Two
Additional Exercises
After performing the skills in this lesson, you may want some additional practice. Below are some sugges-
tions for activities you can try on your computer, along with some questions to check your comprehension of
the material covered in the lesson.
ACTIVITIBS TO TRY:
1. Open and preview other tables in the W&A-2.MDB database. (If using the CD-ROM, open and preview
other tables in the W&A-1.MDB database.)
QUESTIONS:
1. Give an example of when you would use the Data Entry table to add records.
2. When does using the Record Number box make more sense than using the Navigation buttons?
Title #289-450
35
Using Forms
Lesson Three
To practice the skills in this lesson without the CD-ROM, perform steps 5 through 9 only.
2 Choose:
Choose:
Notice: The first skill in the lesson plan begins playing in the "Try
It" mode.
Note: lf you've just completed the "Show Me" segment of a skill,
you can switch to the "Try lt" mode by choosing the START button
under the words "Try lt" in the enlarged Playback Control window.
Titla #289-450
40
Lesson Three skia 3-1
In this skill, you will open the Employees form in Form view and then change to Design view where
you'll examine the Form Design window.
(Cont.)
Title #289-450
4l
Lesson Three skiu 3-1
7 Drag: the title bar of the Toolbox to the right side of the
screen (to move it out of the way, if necessary)
8 Examine: the Form Design window
Note: You may have to scroll down to see the footer section.
Title #289-450 42
Lesson Three skill 3-2
Editing Records
To make changes to a record, simply move to a field's text box and edit its contents. To save the
changes, move to a new record. The changes are automatically saved.
Step by Step 1 Move to: record 3 (the employee named David lsherwood)
2 Press: @3times
Notice: The Title text box is highlighted.
5 Type: West
6 Click: ffi the Next record button
Notice: You are moved to the next record. Ihe ffisymbo/
disappears from the record selector, indicating that the changes
to record 3 are saved.
Tips and You can use the Page Up and Page Down keys to move from one record to another in
Techniques forms. You can also move between iecoids using the Next, PreviouS, LaSt, and First
comnands on the Records, Gc To menu.
Iitle #289-450
43
Lesson Three skia 3-3
Adding Records
Adding records in a form is very similar to adding records in a table. When you add a record to a
form, the record is automatically added to the table from which the form was created.
In this skill, you will add a new record to the Employees form'
2 Type: EMP99
3 Press: Fafsl
4 Type: Morgan
5 Type: Paficia mhl
Notice: The name Patricia Morgan appears at the top of the form.
This form contains an "expression" that tells Access to add the first
and last name to the top of this form.
Tips and You can also move to a blank entry form by clicking on the Last Recoid navigation button, and
thenclickingontheNe1tRec1do1o'*in"''.o'n:o,^.-
Techniques
You can also add'recofds to a form by choosing Fonra Data Entry:
Title #289-450
44
Lesson Three skia 3-4
Deleting Records
Deleting records in a form is very simiiar to deleting records in a table. When you delete a record in
a form, the record is automatically removed from the table that was used to create the form.
In this skill, you will delete a record from the Employees form.
Step by Step 1 Move to: record 67 (the Employee named Todd Verner)
Note: A quick way to move to record 67 is to highlight the record
number in the Record Number box, type 67, and press Enter.
Notice: This is record 67 of 81.
2 Click: in the Record Selector (at the left edge of the form)
Notice: The record selector becomes a darker shade of gray,
indicating that this record is selected.
record.
4 Choose: F,ffiSl
Notice: The record is removed. There are now B0 records.
Note: Peter Leavesley is now record number 67.
Tips and Sometimes recoids cannot be deleted beCause the"table has a one-to-manJ relafionship with
another table. That means that each record appeari onty on"" in "one" table, and can appear in
Techniques
"many" records in the other table. This type of relationship usually enforces,referential
integnty. This means that the "many" table can only use data ttrat exrsts in the "ouel' table, and
you cannot delete any records from the "one" table thai are being used in the "many" fable.
you witt leam more about table relationships and referential integnty in Volume Z of thii
course.
Tirle #289-450
45
Lesson Three skilt 3-5
Closing a Form
When you have finished using your form, close it. Each open Access object requires some of your
computer's memory, so it's a good idea to close objects if you're not working with them.
Step by Step 1 Double-click: the Gontrol-menu box ffi tor the Employees fonn
window
Notice: The Employees form is closed and you are returned to
the Database window.
Title #289-450
46
In Practice: Usins Undo
If you make in a field, you can undo that change using the Undo command.
a change to a value
Choosing Undo again will undo your undo.
To restore several changes made within one field, choose the Undo Current Field/Record button a
single time. Choosing the Undo Current Field/Record button a second time will undo all changes
made to the entire record. However, once you have moved to a new record and saved your changes,
the Undo command will not work.
In this skill, you will practice using the Undo command to restore changes made to a form.
B Press: ' @*@ (to move to the end of the Address field)
I Type: light Street
Title #289-450
47
Lesson Three
Additional Exercises
After performing the skills in this lesson, you may want some additional practice. Below are some sugges-
tions for activities you can try on your computer, along with some questions to check your comprehension of
the material covered in the lesson"
ACTIVITIES TO TRY:
1. Open the Category form and move between records.
2. Examine the Form Design window.
3 View the Category Form in Datasheet view.
4. Close the Category form.
QUESTIONS:
1. Explain the difference between the Undo command and the Undo Cunent Field/Record commands.
-
2. What is the name used to describe the elements in the Form Design window that allow you to work with
individual objects in your form?
Title #289-450 48
Finding and Sorting Data
Lesson Four
51 Title #289-450
Lesson Four Before You Start
To practice the skills in this lesson without the CD-ROM, perform steps 5 through 9 only.
2 choose: lffirliruii,H*ffia*i
l,i*Hf,slf .i*i\Ni'!iilii'''''i'liiiiili'iritr
4 Choose:
Notice: The first skill in the lesson plan begins playing in the "Try
It" mode.
Note: lf you've just completed the "Show Me" segment of a skill,
you can switch to the "Try lt" mode by choosing the START button
under the words "Try lt" in the enlarged Playback Control window.
Tirle #289-450
52
Lesson Foar skiu 4-1
Finding Records
You can use the Find command to quickly locate records in a table or in a form. You can tell Access
to look for an exact'value, such as a name, or you can use a wildcard character to search for parts of
values. A wildcard character is a placeholder that represents anything and everything. For example,
you can use "L*s" to find all records that start with the letter "L" and are followed by anything. You
can use "EMP9#" to look for alltwo digit employee numbers that begin with nine. See the Tip and
Techniques at the end of this skill for more information on wildcard characters.
3 Type: Carmen
5 Choose: l- il
Notice: The name, Carmen, is highlighted in record number 30.
I are not included in the "Try lt" audio
@ CD-ROM Users: steps 6, 7, &
coach.
6 Choose: l$l, 1
7 Click: once in the horizontal scroll bar (to display the Home
Phone field)
Notice: Carmen Washington works in Product Development and
her phone number is (408)446-2374.
11 Choose: lilrniittiii$ffiN
tdi$tsrid$dsiw
12 Close: the Employees table
13 Select: the
- Form object button
14 Open: the Employees form
(Cont.)
Title #289-450
53
Lesson Four skiu 4-1
Finding Records
Step by Step 15 Click: in the Date Hired text box
(continued) '16 Click: ffi tne Find button
17 Type: 2H94
Note: the "*" wildcard character tells Access to find any date
within the month of February, '1994.
19 Choose: ffiii#i--B$if,
Notice: Access has found Karen Chow, hired on 2/7/94.
20 Choose: l...W#SsR
Notice: Access has found Mark Stevens, hired on 2/15/94.
Tips and In step 17, if you ised2ll#194, you would have only searched for days with 2 digits. You
would not have found 217/94. Likewise, searching for 2/#194 would not have found 2115194.
Techniques
.,::,.. AClq $,:{i$ds: * ,':'.:
L*ng Ling #th 5th
Levering 8th
Leka Travel and Trading ith 128th
Paul[lao] Pauli (but not Paula or Paulo)
Sm?th Smith
SmYth
Title #289-450 54
Lesson Four skiu 4-2
Sorting Records
As your database grows, you will need to control the order and type of data that you view on screen.
One way to do this is by sorting data. You can sort data in both tables and forms. When you use the
Sort buttons, Access sorts your database alphanumerically in either ascending or descending order.
In this skill, you will sort the Employees form by last name. Then, you will sort the Employees form
by date hired, in descending order'
Title #289-450
55
In Pructice: A ins s Filter
When sorting data, you can order records by a single field, or by a combination of fields. For
example, the telephone book is sorted by last name, and then by first name. In Access, you can sort
your records by multiple fields using the Filter window.
The Filter window also allows you to specify criteria that tell Access which records you want to
view. For example, you can set criteria that will only display sales consultants. Once you have
created a filter, you can save it as a query.
In this skill, you will sort by multiple fields. Then, you will create a filter that displays only consult-
ants. Finally, you will save this filter as a query called "Sales Consultants."
Field list
Filter grid
7 Drag: the FirstName field from the Field list to the Field
cell in the second column of the Fifter grid
B Click: in the Sort cell of the FirstName column
9 Click: ffi the drop-down arrow
10 Select: Ascending
(Cont.)
Title #289-450 56
In Practice: Annlvins a Filter
17 Choose: l.ffi.$*s-N
Notice: Your list of consultants is being printed.
ff1]]'.T"ll, ,, ,,*,,* to using the Filter window, r.,,;'"r"- on", gr.u,", flexibilitv
eueries are saved as database objects. Filters, on the other hand, need to be set up manually
each time you use them.
Title #289-450
57
Lesson Four
Additional Exercises
After performing the skills in this lesson, you may want some additional practice. Below are some sugges-
tions for activities you can try on your computer, along with some questions to check your comprehension of
the material covered in the lesson.
ACTIVITIES TO TRY:
l. Open the Customers form. Find the customer ID "SFIT." What is the name of the contact for this
company?
3. Change to Datasheet view and sort the form in ascending order by contact title.
4. Create a filter that sorts the datasheet by contact title, and then within contact title, by company name.
OUESTIONS:
1. Name some situations that would require a descending sort vs. an ascending sort.
2. What are some situations in your business that would require sorting by multiple fields?
Title #289-450
58
Llsing Queries
Lesson Five
6l Title #289-450
Lesson Five Before You Start
To practice the skills in this lesson without the CD-ROM, perform steps 5 through 9 only.
2 Choose:
Choose:
Notice: The first skill in the lesson plan begins playing in the "Try
It" mode.
Note: lf you've just completed the "Show Me" segment of a skill,
'you can switch to the "Try lt" mode by choosing the START button
under the words "Try lt" in the enlarged Playback Controlwindow'
Tiile #289-450 62
Lesson Five skia 5-r
Changing Criteria
Your tables and forms act like master lists of information. They are usually a comprehensive
collection of information about one subject, such as a customer list, employee list, orders, products,
and so on.
Queries allow you to extract information from these lists, without affecting the integrity of the
original data. Queries act as filters that collect records meeting specified criteria. The extracted
records are stored in a table called a "dynaset." The query produces an up-to-date dynaset each time
you run the query, so your dynasets always contain current information. There are several types of
queries, but the most common type of query is called a Select Query.
In this skill, you will view the dynasets produced by two select queries and modify the criteria in
this query so that it asks for records with a "Region that equals West."
Step by Step Note: Steps 1 through 3 are not included in Try lt.
Viewing the Source Table:
1 Open: the Employees table
Notice: This table contains B0 records with 10 fields.
Viewing Dynasets:
3 Select: {he Query object button
Notice: There are currently five queries in this database. When
you open a query, it automatically produces a dynaset based on
the table or form used to create the query.
(Cont.)
Titls #289-450
63
Lesson Five skilt 5-1
Changing Criteria
Step by Step Examine: the Query Design window
(continued) Notice: The Query Design window contains menu commands and
buttons for working with queries. The QBE grid is divided into
rows and columns. The columns contain the fields that you
choose to include in the dynaset. The rows allow you to sort the
dynaset, show or hide each field, and specify criteria.
Thisqueryusedthe
Employees table
as its source of
data
Field list
OBE Grid
Click: the right scroll arow ffi for the QBE grid
Notice: This query also includes the Title field. The Show box is
deselected. This field will not appear in the dynaset.
Note: Although the Title field will not display in the dynaset, it is
being used to determine which records will be included. This is
called "specifying criteria on a hidden field."
(Cont.)
Title #289-450
64
Lesson Five skill s-I
Changing Criteria
Step by SteP Ghanging Griteria:
(continued)
I Click: in the Criteria cell of the Region field
10 Type: West Gnter*.ll
Notice: Access automatically added quotation marks around the
criterion. This query now asks Access to collect all the records in
the Employees table with a Title that equals "Account Rep." 9I
"Sr. Acct. Manager," ans! with a Region that equals "West."
Title #289-450
65
Lesson Five skia 5-2
Arranging Fields
You can use the QBE grid to add, remove, or hide fields in a dynaset. You can also arrange the
order in which fields appear in the dynaset.
In this skill, you will hide the FirstName field, so that it does not appear in the dynaset. You will
then move the Extension field so that it appears next to the LastName field.
.
Tips and d.:bv''r6 iuf. pmtfielas (fiom left to right)r Accbss borts:,by.,the1.fitst
field tliii inCludes a sort specification. ,It then sorts within that field by the next field that
Techniques qontainsaso't:'ip.iifi*ution,andsoon'.......'....'..'''
Tiile #289-450
66
Lesson Five skia 5-3
If you want to save your modified query under a new name, without replacing the original QuerY,
you must use the Save Query As command.
In this skill, you will save the modified query as a new object by the name of "Western Sales
Team."
Tirle #289-450
67
Lesson Five skill s-4
Deleting Objects
Deleting objects, such as tables, queries, forms, and reports is easy. You simply select the object in
the database window and press the Delete key.
3 Press: tEnE=]
Notice: The Western Sales Team query is removed from the list
of query objects.
5 Press: @
6 Press: IEilerA
Title #289-450 68
Lesson Five skia 5-5
Printing a Query
You can print queries, tables, forms, or reports from the Database window.
3 Choose: l.s,
69
Lesson Five
Additional Bxercises
After performing the skills in this lesson, you may want some additional practice. Below are some sugges-
tions for activities you can'try on your computer, along with some questions to check your comprehension of
the material covered in the lesson.
ACTIVITIES TO TRY:
1. Open a query and identify the elements of the Query Design window.
2. Create and save a query that shows only employees who live in Los Gatos. Name the query "Los Gatos
Employees."
3. Practice modifying the criteria in the Los Gatos Employees query to display related groups of data.
Include a sort on multiple fields.
OUESTIONS:
1. What is the name of the area where you specify fields and criteria for a query?
3. What happens to a field in a query when you deselect its Show box?
Titl€ *289-450
70
Viewing and Printing Reports
Lesson Six
73 Tiile #289-450
Lesson Six Before You Stsrt
To practice the skills in this lesson without the CD-ROM, perform steps 5 through 9 only.
2 Choose:
Choose:
Notice: The first skill in the lesson plan begins playing in the "Try
It" mode.
Note: lf you've just completed the "Show Me" segment of a skill,
you can switch to the "Try lt" mode by choosing the START button
under the words "Try lt" in the enlarged Playback Control window.
Title #289-450
74
Lesson Six skill 6-1
Previewing a Report
Although you can print data directly from tables, dynasets and forms, reports give you greater
control over how yotrr data is printed. With the power and control of a report, you can produce
presentation-quality reports with minimum effort.
The items on a report (or form) that display or print data are called "controls." With a control, you
can display data from a fie1d, the results of a calculation, titles, graphs, and pictures. You can even
display another graph or rePort.
Reports
+rcEl
M
ffit #
(Cont.)
Ti{e #289-450
75
Lesson Six skiu 6-1
Previewing Reports
Step by Step Previewing a Report:
(continued) Note: Reports are used to output your data to paper. Access
provides an easy-to-use preview feature that can be accessed
from the database window. After previewing your report, you can
either make necessary changes or send it to the printer.
Tips and
Techniques diililild ffi, $e,r ..sefifi u*t*u *r"t* i{tr'e n"p"tt *indo*, on.*'[ e..# $u*p,,uiai[g
box, which is where you specify your printer type, the page dimensions, page orientation, and
While in the Access window. t;; ; output a copy of your ,.fn ,o Microsoft Excel, Mi-
,roroi Wora, o, ruficrosoft fufuit uring the following buttons on the toolbart
milffi
Title #289-450 76
Lesson Six skiu 6-2
Choose:
Notice: The status bar reads "Design View" and the Report
Design window appears.
Title #289-450
77
Lesson Six skilt 6-3
Printing a Report
Although you can print your tables, forms, and dynasets, the preferred output for data is a report.
Printing reports in Access is simple.
In this skill; you will print the Customer Phone List report.
Choose: lHffiffiffiUNN\SNl
ry
Notice: The report is printed.
Tifle #289-450
l8
Lesson Six
Additional Exercises
After performing the skills in this lesson, you may want some additional practice, Below are some sugges-
tions for activities you can try on your computer, along with some questions to check your comprehension of
the material covered in the lesson.
ACTIVITIES TO TRY:
1. Examine the Mailing Labels report in Design view.
QUESTIONS:
i. List three types of reports that you can create using Access.
2. What are some examples of reports that you might need to produce?
Titl€ #289-450
79
rl-,,rnderstanding Database Design
Lesson Seven
83 Title *289-450
Lesson Seven Before You Sturt
To practice the skills in this lesson without the CD-ROM, perform steps 5 through 7 only.
2 Choose:
Choose:
Notice: The first skill in the lesson plan begins playing in the "Try
It" mode.
Note: lf you've just completed the "Show Me" segment of a skill,
you can switch to the "Try lt" mode by choosing the START button
under the words "Try lt" in the enlarged Playback Control window.
Title #289-450
84
Lesson Seven skiu 7-1
There are a few steps that you should follow when planning your database.
Decide which information your database will store. Will it contain only sales information, or
will it include information across every department of your company?
Once you know the purpose of your database, divide it into separate subjects, such as
Employees, Orders, Products, Customers, and so on. Each subj ect will be a table in the database.
Take into consideration how the data is going to be entered and/or updated. Is someone going
to be entering data from a paper form, while on the phone, etc.? This may determine the order
of your fields.
Talk to the people who will be using the database. Be sure to include only fields that relate to
each other. Avoid adding unnegessary fields. It's also important to avoid having too many fields
in one table. Large tables can usually be broken down into smaller, related subcategories.
Look at each proposed table before you create the database, and decide how the data in one table
relates to the data in another table. Add fields to tables or create new tables to clarify the
relationships, as necessary.
Enter some sample information into your tables to see if you get the results you want. Make
adjustments to the design as needed. Think of your initial design as a rough draft that you can
refine later. Experiment with sample data and prototype reports and queries. The best way to
find errors in a database design is to begin using it. It's easy to change the design ofyour database
as you're creating it. However it becomes very difficult to make changes to tables after they're
filled with data, you've created your forms, queries, and reports, and users are on-line using the
database.
(Cont.)
Tiile #289-450
85
Lesson Seven skill 7-1
Creating a New Database File
(Continued)
Common Design Problems:
There are several common problems that occur when designing a database. If you come across
one or more of the following warning signs, you might want to reevaluate your database design.
. You have one database with a large number of fields that don't relate to the same
subject.
. You have many fields in a table that are left blank. This usually means that the fields
belong in another table.
. You have alarge number of tables that contain the same fields. Try consolidating all
information relating to a single subject.
Note: Designing a large database is a complex project. For more information on database design, refer
to your Access fJser's Guide. There are also several books available on database design principles. It's
a good idea to talk to someone who has designed relational databases, and to talk to the people who will
eventually use your database.
(Cont.)
Tirle #289-450
86
Lesson Seven skia 7-1
2 Type: mydb
3 Double-click: 6' c:\ (in the Directories list box)
Choose:
Notice: Access opens a new database window. The title bar
reads "Database: MYDB." There are currently no obiects in this
database.
Note: When you create a database, Access automatically creates
a second file with the same name, but with an .LDB extension. This
file is used by Access to store locking information. Although you
don't need to keep the .LDB file when you back up or copy a
database, you should never delete it while the database is open in
a multi-user environment.
Title #289-450
87
Lesson Seven skiu 7-2
Importing Tables from Another Database
When creating a new database, you may want to import a table (or other object) that exists in
another database. This can avoid hours of unnecessary data entry.
In this skill, you will import a copy of the Employees table from the W&A-7.MDB database file.
2 Choose: N:ffiFj,ffifl
Notice: The Select MicrosoftAccess Database dialog box appears.
The File Name list shows all the Access files in the current directory.
Note: Make sure your current directory is C:\AST.
3 Double-click: the W&A 7.MDB file
Notice: fne mport Objects diatog box appears. The object type is
set to Tables and the Structure and Data option is selected.
5 Choose: ffi$
Notice: A message appears telling you that the Employees table
was successfully imported.
6 choose: |$,{ffi'ffi,ffil
Tips and
Techniques
ln addition to Access objects;.,y6; oan i rt o$ebts ,from. sereral..otbbr,applications, such,,as
Microsoft Excel, Lotus l-2-3. and other spreadsheet applications.
Title #289-450
88
Lesson Seven
Additional Exercises
After performing the skills in this lesson, you may want some additional practice. Below are some sugges-
tions for activities you can try on your computer, along with some questions to check your comprehension of
the material covered in the lesson.
ACTIVITIES TO TRY:
1. Create a new database file and import several objects from the W&A-7.MDB database.
2. Export a table from your new database file to the MYDB.MDB database.
OUESTIONS:
1. Name some things you should consider before beginning your database design.
2. What are some signs that you should reevaluate your database design?
Title #289-450
89
Creating a Table
Lesson Eight
93 Title #289-450
Lesson Eight Before Yoa Start
To practice the skills in this lesson without the CD-ROM, perform steps 5 through 9 only.
2 Choose:
4 Choose:
Notice: The first skill in the lesson plan begins playing in the "Try
It" mode.
Note: lf you've just completed the "Show Me" segment of a skill,
you can switch to the "Try lt" mode by choosing the START button
under the words "Try lt" in the enlarged Playback Control window.
Title #289-450
94
Creating a New Table
To create a new table, you must either open a new Table Design window, or use the Table Wizard.
The Table Design window lets you add, remove, modify, and customize the fields in your table. To
open a new Table Design window, use the New Table button.
In this skill, you will begin a new table, add fields to your new table, and delete one field.
Choose: I.liirililrirfi
Lllll;;iliilt
i$iliillfl
Notice: The New Table dialog box appears. You have the
choice of creating a new table with, or without, the Table Wizard.
-
Click:
l.lew Table
Field Selector'
TheTable Designwindow
is divided into two Panes.
The upper pane contains
the grid used to add fields.
The lower pane disPlaYs
the Field properties of the
active field. There are
currently no fields, so the
Field Properties area is
blank.
The description in the
lower pane will change
depending on the location
of the insertion point.
Lower Pa (Cont.)
Tille #289-450
95
Lesson Eight skiu 8-1
(Cont.)
Title #289-4s0 96
Lesson Eight skilt 8-1
Creating a New Thble
Step by Step 16 Type: Class lD IEnter*l
(continued)
Adding a Description:
17 Click: in the Description cell of the Location field
18 Type: Enter the City name.
Deleting a Field:
19 Click: in the Field Selector 6 to the left of "Units"
Notice: The Units field is selected.
20 Press: lpelm
Notice: The Units field is removed.
(Cont.)
97 Tiile #289-450
Lesson Eight skill 8-1
Tips and faCh time,you open a table;,,it,;g r.Lmatically sprted ih aseending,:oider,by its primW kW
Techniques
Tirle #289-450 98
Lesson Eiqht skiu 8-2
Tips and Vou ian ilso access the Save As dialog box by choosing File, Save As. " , :
:.
Techniques Object names can be up to 64 characters lcng and can contain any number of letters, oumbers,
and spaces, and special characiers except a period (.), an exclamation mart 1l;, i backquote
characGi ('). and bracketi ([ ]),
Tirle #289-450
99
Lesson Eight Skill 8-3
Entering Data
When you have finished designing your new table, and you have saved it, you can change to
Datasheet view and 6egin entering your data.
In this skill, you will change to Datasheet view and add one record to the table.
Techniques
Step by Step Position: the mouse pointer on the border between the
Class Name and Department field headers
Border
,,
v
Notice: The mouse pointer changes to a thick bar with a two'
headed arrow.
Click & drag: the border about one inch to the right
Notice: When you release the mouse pointer, the Class Name
field is widened.
Note: lt may take a few tries to make it the size you want'
Position: the mouse pointer on the border between the
Class lD and Class Name field headers
Double-click:'on the border
Notice: The Class lD field is automatically adiusted to fit the
widest entry.
Choose:
Notice: You are returned to the Database window' The Classes
table was added to the list of table obiects.
Tirle #289-450
101
In Prsctice: Usins the Thble Wizard
The Table Wizard guides you through the steps of building a table. It offers examples and sugges-
tions for your table design and allows you to customize your table as you build it.
The Table Wizard provides templates for both business and personal tables. Suppose you are
buying home owner's insurance and need to store data about your household inventory. The Wizard
has a built-in table already set up to do this.
In this skill, you will use the Table Wizard to create a new table.
t--_;---1
I'J\ |
I E:::lt? I
CD-ROM Users: the "Try lt" audio coach prompts you to choose your
own selecfions while using this Wizard. Regard the
remaining ln Practice steps as suggestions only.
(Cont.)
Title #289-450
t02
In Prsctice: Usine the Tsble Mzurd
Step by Step 5 Select: Household lnventory (in the Sample Tables list)
(continued) Notice: The field HouseholdlnvlD is highlighted in the Sample Fields
list.
B Type: Item#
I Click: in the Fields in my new table list
Notice: HouseholdlnvlD is replaced with ltem#. Thefield ltemName
is selected in the Sample Fields list.
13 Choose:
Notice: The Table Wizard prompts you to name your table. You can
choose to set a primary key yourself , or have Access do this for you.
The default is to let Access sef the primary key.
14 Choose: ffifl (to accept the suggested name and have Access
set the primary key)
Notice: Your new table is not related to any of the tables in your
database.
15 Choose:
Notice: The Table Wizard is ready to create your table. You can
choose to modify the table design, enter data directly into the table,
or enter data into the table using a form the Wizard creates for you.
16 Choose:
Notice: The table is created and you are placed in Datasheet view.
You can now enter your data. The first cell in the ltem# field reads
"Counter." Access automatically made this the primary key and used
the Counter data type. This data type will number each value in this
field consecutively.
ACTIVITIES TO TRY:
1. Use the Table Wizard to create a new table.
QUESTIONS:
1. Why would you create a new table without using the Table Wizard?
3. Explain the difference between field column width and field srze.
Title #289-450
r07
Lesson Nine Before You Start
2 Choose:
Choose:
Notice: The first skill in the lesson plan begins playing in the "Try
It" mode.
Note: lf you've just completed the "Show Me" segment of a skill,
you can switch to the "Try lt" mode by choosing the START button
under the words "Try lt" in the enlarged Playback Control window.
Tifle #289-450
108
Lesson Nine skia 9-1
In this skill, you will change the Unit Price data type to Currency.
Wry
i..r........................... ......i
i60 i
...{.F-.......-. .*-----1
i7 6.5 J
i
l
i{3-5" I
i 65.55 ......1
Datatype-ieii ffi;
Click: W the arrow beside the Data Type cell
Notice: A list box with several data types appears.
6 Select: Currency
Notice: The data type changes to Currency. Also, the Format
property box in the Field Properties section reads Currency.
(Cont.)
Title *289-450
109
Lesson Nine skill 9-1
tffisrEFffil
I .. ...$.7,0.-0-.;
i $60.00 i
, $4soo
I $z,oo
i
I
, $6,50 ]
i $435'00 l
i $65.55 I
Tips and When you change d"t" type, the properties for that field change to the default setting for the
new data type
Techniques
The following ialte determines the correct data type:
Data Type Values Stored
Text Alphanumeric characters
Memo Alphanumeric characte* (usually several sentences or paragraphs)
Number Numeric values (integers or fractional values)
Date/Time Dates and times
Currency Monetary values
rifle#28s-450 I10
Lesson Nine skill 9-2
In this skill, you will set a field property that requires data to be entered in a field.
j[]$r€,,,rt,,,,,,,*r,r,,r,,,::::1i:{r+j}jiiiiiiiititiiiiiririjjti:it.+n#NTiilirritfriiil.
I
;Flequireil'
r, '':::i:::,. . No I'\
rd
Notice: A list box appears with two choices - Yes and No.
Current setting :!
Yes
List box
(Cont.)
Title #289-450
111
Lesson Nine skia 9-2
(Cont.)
Title #289-450
tt2
Lesson Nine skiu 9-2
DecimalPlaces Displays a certain number of places after the decimal point when
using a format for a Number or Currency field.
Captiori Specifies a label other than the default label (field name) for new
forms and reports.
Indexed :
Speeds up searches on fields that are searched frequently.
Title #289-450
113
Lesson Nine skiu 9-3
Creating an Input Mask
Input masks simplify data entry when the values you enter in a field have the same format. An input
mask automatically displays and enters formatting characters, such as parentheses, in a field so that
they don't have to be typed each time you enter values. Input masks also ensure that the data entered
will fit in the field.
In this skill, you will create an input mask for the Order Date field.
4 Click: in the lnput Mask property box (in the lower pane)
Notice: A Build button appears to the right of the lnput Mask propefi
box.
Build
Button
lnet)tiffia$fi #,
(Cont.)
7 Choose: rffifl
Notice: The next step of the lnput Mask Wizard appears and it
provides the choice of a placeholder.
I Click: lwil
10 Examine: the lnput Mask proper$ box
Notice: The Short Date input mask characters are entered in the
lnput Mask property box.
.
$f,lffijiffS.ffiR\Nid-El.Eslri0jo;- ffi
Note: Mask characters serve as placeholders in a mask. They
indicate the values that can be input, and how the mask is displayed.
.Mask placeholders are replaced when you enter characters in a field.
16 Press: @
Notice: The format property applies the Long Date format to the
data entered i - riiaav. Apiit i E. 1gg4j
(Cont.)
Title #289-450
115
Lesson Nine skiu 9-3
Tips and
Techniques Mask Character InterPretatio;r
0
converted to spacesj
L Letter (entry required)
? Letter (entry not required)
A Lefter or digit lentry required)
a Littei or digit (entry not required)
& Any character or space (entry required)
C Any cbaracter or space (entry not required.)
claracter in the input mask--use when you want to include one of the
Speeding up the operations of searching and sorting tables is important when your tables become
large. To do this, Access allows you to create an index for a field, similar to the indexes you find in
books. Access can find data quickly by looking it up in the index instead of searching the entire
database.
In this lesson, you will create an index for a field that contains last names.
ffiEIl ,Wa-!ke1
EMP10 Sellers
EMP]00 ,Palricia
Ascending EMP] 2 , lsherwood
order EMP'14 , Plumas
EMP.IS : ChiN
EMP]6 DeMarco
Eieldr:FiopeiliH*,iii
lize ,,"'.
lietd
u0.....'.,
lorm€t
:t : t.t :r | :..)..1: :::::::. ::: : : : : : : : : :
::::::::::::t.::t))::
,
,',
itnn$la:e*;1';iii;]1i i;iiii
.[eniioniii.ir;rriurii:i.rt. E;pi;r;; iD
:,BFlEu[i\r8l' q......., j..i. F.TB
llll::lii:E
1v[liflari$r.Fu*;giiir ::u
V,stidatiFni.I'e#t....i..ii. :1,:::::il
.n*ilti$d..ti.i.....i...i.i..........
No
*f t*rir .tr€ig,. tteiiuilt: No
,lndErted:l:,i, ::r:::::r::::::r:::rr::: Yes [No DupticatesJ
(Cont.)
ufllsle .,.i ,Yes 1....1 he nbme foi this inden Eacfr ir.rije+r can use:up
.l$ii(e.iFlffi ,No l:it:il !:
.: :: fidds^
:,lo:10 ::
The Primary property identilies the EmployeelD field as the primary key. The Unique
property indicates that there can't be any duplicate values in the field. The lgnore Nulls
property indicates that all cells in this field with a null value will be included in the index.
7 Select: LastName
Notice: The LastName field name is entered in the Field Name cell.
8 Click: ffi tne lndexes button (to close the lndexes window)
I Click: ffi tne Save button
10 Close: the Employees table
Title #289-450
Lesson Nine
Additional Exercises
After performing the skills in this lesson, you may want some additional practice. Below are some sugges-
tions for activities you can try on your computer, along with some questions to check your comprehension of
the material covered in the lesson.
ACTIVITIES TO TRY:
1. Open the Employees table in Design view'
QUESTIONS:
1. What does a data type determine?
To practice the skills in this lesson without the CD-ROM, perform steps 5 through 9 only.
Choose:
Choose:
Notice: The first skill in the lesson plan begins playing in the "Try
It" mode.
Note: lf you've just completed the "Show Me" segment of a skill,
yeu can switch to the "Try lt" mode by choosing the START button
under the words "Try lt" in the enlarged Playback Control window.
Title #289-450
t24
Lesson Tbn skill 10-I
Viewing Database RelationshiPs
Why Relationships are Used
Once tables are created, relationships can be established between those tables with related information.
Access uses relationships to find and manage associated information stored in the database. In order for
a relationship to be formed between tables, they must have a field in common. Usually it'sthe primary
key of one ofthe tables involved in the relationship. To establish a relationship, click and dra gtheprimary
key fi.eldfrom one table to the related field in another table. The related field is referred to as the foreign
key. In the example below, a relationship has been established between the Customer ID fields in the
Customers table and the Orders table.
Primary table
Related table
Foreign key
field
Suppose you want to delete a customer from your database, and you wanted all the orders for that customer
to be deleted as well. Since the two tables are related, deleting a customer's record from the Customers
table will automatically delete associated records in the Orders table.
(Cont.)
Title #289-450
125
Lesson Tbn skilt I0-1
Viewing D atab3f,f"S.tatio ns hip s
Types of Relationsh'ips
One-to-Many
A one-to-many relationship is the most common type. In this type of relationship, a record in
the "one" table can have more than one related record in the "many" table. However, a record
in the "many" table has only one related record in the "one" table.
"One" table
enses
BKSD Borko Studios Mellsqa Bo,1ko
Manylo-Many
In a many-to-many relationship, a record in one table can have more than one matching record
in a second table. The second table can also have more than one matching record in the first table.
For example, each order in the Orders table can have many products, and each product in the
Products table can appear in many different orders. To establish a relationship between these two
tables directly, you would need to repeat information over and over again in one of your tables.
This is inefficient and can lead to data entry error.
(Cont.)
Tiile #289-450
t26
Lesson Ten skiu 10-1
The solution is to create a third table that breaks down the many-to-many relationship into two
one-to-many relationships. You put the primary key from each of the two tables into the third
table.
13 Actualierng Self
14 Actualizing Self
One-to-One
This type of relationship is rare. In a one-to-one relationship a record in either table has no more
than one related record in the other table.
"One" table
"One" table
Each California customer has one matching record in the Customers table and vice versa
Referential IntegrifY
Referential integrity is a security feature applied to some relationships. Referential integrity helps
protect the validity of relationships. This protection is applied so that related data isn't accidentally
altered. For example, if referential integrity is enforced in a one-to-many relationship, you can only
add records to the "many" table if the related record exists in the "one" table. Likewise, you can't
delete records in the "one" table if there are related records in the "many" table'
(Cont.)
Join line
"many" side
Tips and
Techniques :Relbiiofships..menu,.of.clidk..ttie... ]etl.,Raixiuffis.,bufion,on, itbo1h'nir::,:iTbi,vib*f e,..
relailonships for a specific table, select that table in the Relttibnships windo* and choose the
Show Direct command from the [etaiionships menu or click the Show Direct Relationbhipi
button on the toolbar.
Title #289-450
128
Lesson Ten skill 10-2
In this skil1, you will add the Customers and Orders tables to the Relationships window.
lTffi;.I:
l*'*i* :
Vi*Ytt.::::::i:ijtir:, ] : :. ] ]. l | |: i ! i: : : : i ] ] i: : : : : : : : : : : }
,
Notice: The Add Tabte diatog box appears. The Table/Query list box
contains atl the table names for the database. The View section lets
you display only tables, only queries, or both.
5 choose:1.,.-il---....W...---ffi
Notice: The field list for the Orders table is added to the
Retationships window. Also, the primary key field name in the
Customers table is bold.
y"".a11 op* in" ead futte dialog box by choosing Relaiionships, Add Table froni the menu. Yorr
Tips and
can add taLles or queries to the Relalionships window by dragging them from the database window'
Techniques [l liei : bt*:fiu6. ,Rqi[tXO .ffindbwj.s*lebi.fiu.iitl$:$ffi.o$ih$:fie1il.1i#:you.wamdeiet€d;
andiipr.es'S:;Aei*e'
Title #289-450
t29
Lesson Tbn
Additional Exercises
After performing the skills in this lesson, you may want some additional practice. Below are some sugges-
tions for activities you can-try on your computer, along with some questions to check your comprehension of
the material covered in the lesson.
ACTIVITIES TO TRY:
L Open the Relationships window.
OUESTIONS:
l. For what purpose does Access use relationships?
To practice the skills in this lesson without the CD-ROM, perform steps 5 through 9 only.
2 Choose:
Choose:
Notice: The first skill in the lesson plan begins playing in the "Try
It" mode.
Note: lf you've just completed the "Show Me" segment of a skill,
you can switch to the "Try lt" mode by choosing the START button
under the words "Try lt" in the enlarged Playback Control window.
In this skill, you will add the primary key from the Customers table to the Orders table.
Click & drag: the primary key field, CustomerlD, from the Customers
table to the CustomerlD field in the Orders table
Notice: When the field is dragged, the cursor changes to a rectangle.
Also, when the field is placed on the related field, the Relationships
dialog box appears.
Related Fields
(Cont.)
Tifle #289-450
135
Lesson Eleven skill 11-1
Choose:
Notice: A one-to-many relationship line is drawn between the
Customers and Orders tables. The number "1 " at the Customers end
of the relationship line indicates that one customerfrom the Customers
table can have many orders in the Orders table. The many side of the
relationship is indicated by the infinity symbol. Also, referential
integrity is indicated by the solid bars at each end of the relationship
line.
One{o-many
relationship line
lnfinity symbol
(Cont.)
I Press: @
rffil
10 Choose: l$si$-tdN-E
littd&w
11 Close: the Customers table
Referential integrity prevents you from deleting or changing records that are related to other records
in another table. However, you might want to delete the shared record from both tables. To do this,
you can use the Cascade Delete feature.
When Cascade Delete is selected, Access will delete records in related tables once you delete records
in a primary table.
In this skill, you will use Cascade Delete to delete records in related tables.
Double-click here
Notice: There are two check boxes for "Cascade Update Related
Fields," and "Cascade Delete Related Records."
5 Choose: lffi*,W-]i#Lil,r,l
{Cont.)
Title #289-450
r38
In Prsctice: Usins Cascade Delete
To do this, you create a third table that links two related tables. The third table contains the primary key
from the other two tables. A one-to-many relationship is established between the third table and each
related table. This permits records in each of the related tables to call upon multiple records in the other
table. As a result, the need to repeat records in either table is eliminated.
In this skill, you will create a many-to-many relationship between the Orders and Products tables.
4 Choose:
5 Move: the field list for the Order Details table between the
field list for the Orders table and the field list for the
Products table
Move: the field list for the Orders table to the left (to create
more space between it and the Order Details table field
list)
Notice: The join line changes depending onwhereyou placethefield
list.
Move: the field list for the Products table to the right (to
create more space between it and the Order Details table
field list)
(Cont.)
Primary key
Notice: The Order Details table contains the primary key from both
the Orders table and the Products table.
Click & drag: the OrderlD field ftom the Orders table to the OrderlD
field in the Order Details table
Notice: The Relationships dialog box appears.
10 Click: ,ffi,iffi(toselectit)
11 Choose: rffin
One-to-many relationship
OrHD
CustomerlD
EmployeelD
0rderDate
Required-byD
12 Click & drag: the ProductName field from the Products table to
the ProductName field in the Order Details table
Notice: The Relationships dialog box appears.
13 Click: iHffi(toselectit)
(Cont.)
Additional Exercises
After performing the skills in this lesson, you may want some additional practice. Below are some sugges-
tions for activities you can try on your computer, along with some questions to check your comprehension of
the material covered in the lesson.
ACTIVITIBS TO TRY:
1. Open the Relationships window.
2. Add the Employees table to the Relationships window'
3. Create a one-to-many relationship between the Employees table and the Orders table using the
EmployeelD field. The Employees table is the primary table.
4. Enforce referential integrity for the relationship between the Employees and Orders table.
QUESTIONS:
1. Why would you create a one-to-many relationship?
2. Describe a situation in which you would apply either Cascade Update or Cascade Delete.
A query is similar to a question. You ask the a Save and View the Dynaset
database a question and you receive an answer in a Sort Records
the form of a dynaset. A dynaset is a set ofrecords
that the query retums. a Specify Criteria
The QBE grid is where you will set up the query a Set Criteria for a Hidden Field
or question that you want Access to act upon' a Create a Calculated Field
Specifying criteria in the QBE grid allows you to
focus your queries on avery specific collection of
data. Access uses the criteria to search the
database and find only those records that match
the criteria specified.
To practice the skills in this lesson without the CD-ROM, perform steps 5 through 9 only.
2 Choose:
Choose:
Notice: The first skill in the lesson plan begins playing in the "Try
It" mode.
Note: lf you've just completed the "Show Me" segment of a skill,
ypu can switch to the "Try lt" mode by choosing the START button
under the words "Try lt" in the enlarged Playback Control window.
Tirle #289-450
148
Lesson Twelve skia 12-1
In this skill, you will select the Order Details table on which to base a query.
Choose: Irjiliiii$l#it|ii[$"\l
2 l$tlllllrji:ji,Il
Notice: The New Query dialog box appears
:liiillsi,sntt$)il
I il:Eriill ji l liiili :ll ::!l'l
Clar*es
Cu*tomert
Table names Employee*
Order Detail*
Order*
Ploduct*
(Cont.)
Title #289-450
149
Lesson Twelve skill 12-1
Field list
Choose:
Step by Step Click & drag: the OrderlD field from the Order Details field list to
the first Field cell in the QBE grid
Notice: The OrderlD field is added to the QBE grid.
Field name
t:::::iEis*
'::'::iiiBfii#
SIItHAI:
E;iitqffi
:i,iii!:riii:itlti
QBE grid
Field cell
0rder Details."
0rderlD
ProductName
Field list
Quantity
UnitPrice
(Cont.)
Tirle #289-450
15i
Lesson Twelve skiu 12-2
7 Click & drag: the selected fields to the third Field cell in the
QBE grid
Notice: The Quantity and UnitPrice fields are added to the QBE grid
in the third and fourth field cells respectively, and the UnitPrice field
is highlighted.
8 Press: @
Notice: The UnitPrice field is deleted from the QBE grid.
Tips and You ian also add fieids toit .QBB;gdd.b#.double'c1ic.ffi.th€$;tbs .'ping eifie-ld.n $:enelo$$d
in qquare brackets i4 a field leil. Ifyou drag the asterisk that appears at the top ofthe field list to
Techniques
a field cell, all the fields in that table will:be added to lhe QBE grid.
Title #289-450
t52
Lesson Twelve skiu 12-3
Step by Step Click: ffi tn" Datasheet View bufton (to run the query and
view the dynaset)
Notice: The Select Query:W&A Order Details dynaset is displayed.
The query pulls data from the Order lD, Product Name, and Quantity
fields of the Order Details table.
Title #289-450
153
Lesson Twelve skiil I2-4
Sorting Records
When viewing the dynaset, it often helps if the records are in a pre-defined order. Sorting records is one
way to order records.. Sorting allows you to place records in alphabetic order or in numeric sequence.
To speciff a sort order, you use the Sort cell in the QBE grid. Access allows you to sort by any field that
appears in the QBE grid.
In this skill, you will sort the Quantity field in descending order.
Sort cell
iii:iiriEH
iiiii.lif,wu
;.,S;fiiiffi
Ef!!#rtiii
ijji:;::iiitii0ti
Ascending
Sort choices D
Select: Descending
Notice: Descending is entered in the Sort cell.
(Cont.)
Sorting Records
Step by Step
(continued) Click: ffi tne Datasheet View button
Notice: The dynaset is displayed. The Quantity field is in
descending order.
q:
'''''''''-.-:-:
70 Cooorate Dunamo Si
77,Ac1ua1i_zrng Selt 9;
.....-...,41-C--o--1p91-a-!-q--f,-,q-mm,q!tqi_o_n.-Qf nenip--**. 7i
26. The Po.,'re1 o_fMylh il
1:
40i Give Me Your Tired Huddled Masses
so, M"t rg ihe MelamorpLr on ti1q"- 1l
li
7_21 Myth
The P_gwer 9f " 7l
85, The Power of Myth . 7i
solA;tuddinq-$eiLseriii,
8$ Actualizing Self
__ -__- ----- -i - ....."8i
Titl€ #289-450
155
Lesson Twelve skill 12-s
Specifying Criteria
One of the most powerful features of queries is the ability to limit the dynaset to certain records. You
accomplish this by specifying criteria. To specify criteria, you create an expression. Access uses the
expression to determine which records to display in the dynaset.
To create an expression you can type it in the Criteria cell ofthe QBE grid oruse the Expression Builder.
In this skill, you will specify criteria for the Quantity field by typing in an expression.
iiii;iri:Fi iilr
i1;iiiir1$siri
iiiiiis#ei;ii:l
Click here
]],S1fi*r;eii
:i:i!i....:......Ol'i
Type: >7 El
Notice: The insertion point moves to the "or" cell i n the Quantity field.
Type: =f
Note: The text entered is called an expression. The expression
indicates that Access will search for all the records that have seven
or more products ordered.
Expression
(Cont.)
Specifying Criteria
Step by Step
(continued)
Click: ffi tne Datasheet View button
Notice: The Select Query dynaset displays allthe records with seven
or more products ordered.
Tips and To set criteria fbr fields with ihe Number, CurrenCy, oi Counter,data types;,,snter thC digits and the
deeimal symbol (if appropriate). You don't need,to:use currency or thousand separator symbols.
Techniques
The followrng:eiample formats will work for entering dates: l8 February 1994; 2/I8l94,l81F.eb-
ig94, Feb lB g4t, #2/'18/94#. When entering text in the Criteria call just tJ.pe the valueS. 'ThC
t'on,'l' or
criteria cell ii
not case sensitive' To furd Yas values, ent€r "Yes,il "True,': "'l " in''the
Criteria cell. To frnd No values,:enter "No," "False," 'loff," or "0.'r : :' '
Tiile #289-450
r57
Lesson Twelve skia 12-6
In this skill, you will specify criteria for the UnitPrice field, then hide the field in the dynaset.
(Cont.)
Title #289-450
158
Lesson Twelve skiil 12-6
Title #289-450
r59
In Practice: Creating a Cslculuted Field
Fields in a query aren't limited to the fields from the table on which the query is based. This gives
you great flexibility in designing your queries to perform tasks other than selecting records.
A common task for queries is to perform a calculation. You can add a calculated field by entering an
expression in a field cell or by using the Expression Builder.
In this skill, you will add a field using the Expression Builder that calculates the total price for each
record in the Order Details table.
Expression Builder
(Cont.)
Tiile #289-450
160
In Practice: Creating a Calculated Field
-
IOrder Detail*l![Quantity] [Order Details]![UnitPricel
10 Choose: tl
ry
Notice: The expression is partially visible in the field cellto the
right of the UnitPrice field.
tTnter;l
Notice: Access names the new field "Expr|." Following the new
fietd name is a colon and then the expression in brackets"
(Cont.)
Title #289-450
161
In Pructice: Creating u Calculsted Field
Format
property
box eneral Date :6/19/34 5:34
Long Date Sunday.June ,
Medium Date 19Jun-94
Short Date 6/19/94
Format types
Long Time i5:34:23 PM
Medium Time 5:34 PM ,
Short Time ]7:34 .
GeneralNumber 3456.789
16 Type: G
Notice: The list scrolls to the Currency selection, and currency is
entered in the Format property box.
(Cont.)
t62
n Practice: Creating a Calculsted F,
!qi $Zo!o i
9i $-FQ.7! j
.. "gi $ffi0n l
70.Copol.-a-J,e.Dy_pemo.. Si . $.s]*ru..l
^ .
gi
i7,A_clqaflging Sell .. $_8.3,Qp.__
4j C-o,1pg1are C-ggrpu11iggJlo11 Dy''111gmicq 1l $45.50
26 The Power oI Myth $52 50
Additional Exercises
After performing the skills in this lesson, you may want some additional practice. Below are some sugges-
tions for activities you can.try on your computer, along with some questions to check your comprehension of
the material covered in the lesson.
ACTIVITIES TO TRY:
1. Open a new Select Query Design window
7. Speciff a new criterion for the Quantity field and view the dynaset.
9. Add the UnitPrice field to the QBE grid, specify a criterion, and hide the field.
OUESTIONS:
1. How do dynasets differ from tables?
2. How does setting a sort in the QBE grid make viewing the dynaset easier?
5. How do you prevent a field in the QBE grid from being displayed in the dynaset?
6. Why would you specify a criterion for a field in the QBE grid?
7. Give one example of why you would set criteria for a hidden field.
t64