You are on page 1of 61

Lesson 1: Introduction to Databases

Objectives

By the end of this lesson, learners should be able to:

• Understand the usefulness of a database


• Define a relational database
• Appreciate databases using real world examples

Organizing Our World

The world generates an enormous amount of data from virtually every imaginable aspect of living -- credit cards, store merchandise, telephone
systems, web sites, etc. Years ago this was a manual effort to track and report against this information. Today, computer systems and databases
manage this information. Databases simplify our lives.

Think of an address book you might buy in a pharmacy. In it, you will write all your important contacts -- friends, family, relatives, companies,
recruiters, and other people in your network. The address book contains all the data you need to contact anyone at any time.

Organizing Our World (continued)

Now what if you needed to pull out those contacts that represent family members? Perhaps another family member might want this information. You
would have to flip through all the pages of the address book and write down the exact same information onto another piece of paper, or perhaps even
another address book. This is time-consuming. Contact records are duplicated. A change to one phone number means it has to be changed in two or
more places: in the address book and anywhere else where you recorded the information.

Over time, your address book will become old and worn. The records in it will be crossed out and changed as people move from one place to another,
or change their phone number. You need a new address book. And then you need to rewrite all that information again in a brand new book.

It's a lot of work.

What you need is a database.

What is a relational database?

A database maintains order and structure in our lives. It is easy to maintain. It manages information and then shares it with other tables and databases.

Many entries in your address book will undoubtedly contain identical information -- name, address, city, state, zip code, and phone number. This
information might be written into a table called the Contacts table.

You may want to structure your address book so that family members are separated from companies called during an employment search, for
example. These categories -- family, friend, relative, company -- might appear in a second table called Contact Types.
-1-
Maybe you want write notes for certain calls. This is useful during an employment search. Information pertaining to a telephone call -- date, time,
and notes, for example -- might be saved to a third table called Calls.

What is a relational database? (continued)

The information contained in any one table might in and of itself tell us very little. The Contact Types table, for example, provides relatively little
information that stands on its own: Family, Friends, Relatives, Companies, Recruiters and Network.

However, if you could relate this table to the Contacts table -- name, address, and phone -- then you could separate contacts by category. The Contact
Types table becomes useful, therefore, when related to another table.

Similarly, by relating the Calls table with the Contacts table you can relate specific phone calls to specific people.

The power of a relational database is twofold: 1) information is managed in separate tables to make maintenance easier, 2) data can be combined by
relating different tables.

Real world examples of database applications

Databases play an enormous role in nearly every aspect of our lives. Think of the amount of credit card transactions that take place during a given
day, from receiving authorization at the point-of-sale, to applying the purchase to your credit card, to the store receiving payment from the credit card
company. There are many stores, many banks, and many credit cards involved. Databases are all around you. You only need to learn how to view the
world in terms of databases.

Think of your favorite department store. Chances are the one you shop at is just one of several in the chain. And these stores are probably located in
different states. Databases manage this information.

Inside the store there are different departments: Ladies', Men's, and Electronics, to name a few. Within Electronics, there are different categories
called classes and these might be represented by radios, televisions, CDs, and DVDs. More databases.

And within any given class -- CDs, for example -- there are subclasses like jazz, rock, country, and classical. Within rock there are bands and within
bands there are recordings.

Get the idea? Even more databases.

-2-
This structure categorizes different kinds of information at nearly every level of the store. It is essential to maintaining order and accuracy.

Real world examples of database applications (continued)

How do these databases work together? Well, everything in retail begins with the product or item. Each item has a barcode that uniquely identifies it.
These items are defined in an Item database and associated with a specific department defined in a Department database.

When a buyer decides to purchase some products for sale in a store, he or she creates an order in a Purchase Order database, pulling the individual
items to buy from the Item database. The order might then be transferred to Communications databases that electronically transmit the order to the
vendor, and also to an Accounts Payable database to pay for the merchandise.

Trucks deliver merchandise to the store (don't forget the vendor has their own databases that tells what they shipped), where the products received are
input into a Receiving database. The received quantities are then matched against the original Order database to make sure that all products
ordered were received.

An Inventory database might tell the sales clerk which items to move to the selling floor because the shelves are bare, and what other items might
be stored in the stockroom. For items moved to the selling floor, a Shelf Planning database might tell the clerk exactly where to place the product on
the shelf.

When you shop and take items to the checkout counter, the cash register will lookup the price of each item in the Price Lookup database. Want to
pay by check or credit card? Databases are used to ensure that sufficient funds are available in the account.

Every item sold in the store needs to be removed from inventory so that it can be re-ordered. This adjustment might be made in the Inventory table
to alert the buyer that a certain amount of items need to be ordered to refresh the store's inventory.

Many things happen and many databases are used to make sure the products you want make their way from the manufacturer to the stores and then
into your homes.

Challenge!

The next time you are in a restaurant, a supermarket, or just driving through a stop light, think of what is going on around you, and try to see what
goes on behind the scenes as if everything supporting it is managed by a database.

Here are some examples:

• A restaurant needs to buy food to make menu items. The menu is structured in some manner. The restaurant has to pay bills. Customers
have to pay for meals.
• The supermarket is stocked with items. Items are ordered, shipped, and stocked in the store. The supermarket has bills to pay. The cash
register looks up prices. The customer pays for products.
• Streets are built in towns. Traffic lights are installed at intersections. How do these lights work? Do they all turn red at the same time? Do
they all turn green at the same time?

Now think of your home and view it in terms of a database. For example, you buy products. How is your checkbook managed? There are different
rooms in your house. What are they and what is contained in each? You develop dinner throughout the week. Is there a menu driving what you have
or do you eat certain dishes on certain nights?

Come up with two different aspects of home living and think about whether or not it can be supported by a database. This is not to say that we are
going to create a database for it; only to think of a structure or organization behind some process.

-3-
-4-
Lesson 2: Database Concepts

Objectives

By the end of this lesson, learners should be able to:

• Understand the relationship of database components


• Understand the specific roles of tables, forms, queries, and records

What is a Database?

A database is a collection of information organized and presented to serve a specific purpose. Database programs are created using a program like
Microsoft Access 2003.

A Microsoft Access database is made up of several components including:

• Tables
• Forms
• Queries
• Reports

These components are called database objects. One or more of these objects are formed when a database is created. These components are stored in
a single database file.

What is a Table?

Data is stored in one or more tables. Separate tables are usually created for specific topics, such as products or suppliers. Tables can be related to one
another to access the different types of information. Because data is stored only once -- you probably would not save the same information in two
different tables -- your database becomes more efficient.

The columns and rows in an Access table resemble an Excel spreadsheet. Tables organize data into columns (called fields) and rows (called
records). A record is comprised of one or more fields, depending on the number of fields defined to the table.

-5-
Individual fields in an address book table might consist of name, street address, city, state, zip code, and phone number. A single record is an entry
that uses all these fields, such as your brother or sister's contact information.

What is a Query?

A query lets you find and retrieve information from one or more tables based on a set of search conditions you define (e.g., certain fields in one or
more tables). The results can be displayed in a manner of your choosing. Queries can be created using a wizard or developed from scratch in the
Query Design view.

What is a Form?

An online form can be created to view, input or change information in one or more tables. In this course, we will see how forms are used as both
menus and as data entry forms to database tables. Forms can retrieve data from one or more tables, and display the output on the screen.

-6-
What is a Report?

A report is an effective way to analyze and present data in a printed format using a specific layout. You have control over the size and appearance of
information printed on the report, similar to formatting you perform in a Microsoft Word document.

Challenge!

The best way to understand databases is to learn how to view the world and the things in it, and then think of structures that best serve to organize
this information.

For example, think of your music collection in terms of a database. The database might be called music collection. What tables might be in this
database?

• Do you have both CDs and tapes, or just tapes? Could this media type be an example?
• Do you listen to different styles of music? Could music style be a table?
• Do you listen to different musical artists? Could musical artists be a table?
• Do you have more than one recording for any artist? Could specific recordings be a table?

Here is your challenge:

1. Using the questions above, outline a structure using those questions for which you answered "yes" (or any other questions that you might
think of).
2. List at least five items from your collection that could go into each category created in step #1. If your music collection is not large enough
to list five items in each category, then think of artists that you know about and use this information as if you owned it.
3. After completing step #2, the database has some information defined to it. What report might you want to print that tells you about some
part of the information in the database?

This step, looking at the information to be categorized, is the first step toward designing a database.

-7-
-8-
Lesson 3: Identifying the basic parts of the Access window

Objectives

By the end of this lesson, learners should be able to:

• Identify the parts of the main Access window


• Identify the parts of the database window
• Understand the role of the design windows

Launching Microsoft Access from the Windows Desktop

Microsoft Access is launched from the Windows desktop in a manner similar to that used to launch Microsoft Word, Excel, or PowerPoint. You can
launch Microsoft Access either from the desktop shortcut or from the Start program.

To open Microsoft Access using the desktop shortcut:

• Double-click the Microsoft Access shortcut icon on the Windows desktop.

To open Microsoft Access using the Start program:

• Click the Start button located in the lower left corner of the Windows screen.
• Click the Programs option on the Start menu.
• Click the Microsoft Access selection.

(If Access does not appear, then click the double down areas immediately below the Microsoft PowerPoint entry and locate Access from a
complete list of software installed on your computer.

The Main Access Window

When you open Microsoft Access, many items you see are standard in most Microsoft software programs like Word, Excel, and PowerPoint.
-9-
Menu bar

The Menu bar displays all the menus available for use in Access 2003. The contents of any menu can be displayed by clicking on the menu with the
left mouse button.

The Main Access Window (continued)

Toolbar

The pictured buttons in the toolbar are quick and easy shortcuts to specific actions. For example, if you want to save a spreadsheet using the menus
then you would first click File and then click Save. Using the toolbar to perform this save operation actually saves you a click. Click the save button
once to save the spreadsheet.

Some commands in the menus have pictures or icons associated with them. These pictures may also appear as shortcuts in the Toolbar.

The Database window

Database Toolbar

- 10 -
The Database toolbar presents operations that can be performed against different database objects, including buttons to open an object, design an
object, create a new object and delete an object.

Left Pane

Database objects are created and opened by choosing any of the buttons listed in the left pane of the database window.

Right Pane

Any of the first four options -- Tables, Queries, Forms, or Reports -- opens additional choices related to that selection in the right pane.

Choosing the Tables button, for example, displays at least three options in the right pane: 1) Create a table in Design view, 2) Create a table by using
wizard, and 3) Create table by entering data. It also shows any objects that you created in the database.

Challenge!

• Display the contents of the File, Edit, View, Insert, Tools, Window, and Help menus in the main Access menu bar. As each menu is
displayed, you may want to write down all the contents listed under each.

• Identify the operation performed by each button in the main Access toolbar.

• Some buttons in the toolbar also appear alongside options listed in a menu. For each button in the main Access toolbar, identify the menu
where that operation can be performed.

- 11 -
Access 2003

Lesson 4: Database Tables

Objectives

By the end of this lesson, learners should be able to:

• Understand datasheet basics


• Understand field properties
• Understand table relationships
• Understand the role of the primary key

Datasheet basics

The core component of a database is a table. Data is defined and stored in a table. Multiple tables -- each consisting of different types of data -- can
be created in a database.

Each row in the database is called a record. The entry for John Smith is called a record. The entry for Martha Tompkins is also a record. Each row or
record is made up of columns or fields -- L.Name, F.Name, Phone, Address, City, State, Zip -- which contain a particular piece of information.

L.Name F.Name Phone Address City State Zip


Smith John 919.555.6320 100 Paramount Parkway Morrisville NC 27560
Tompkins Martha 919.555.6427 97 Hummingbird Court Cary NC 27513

In a Contact Management database, a list of names -- those contacts to whom you have sent resumes or have met through your personal network --
might be maintained in a table, along with address, phone number, and other personal information.

Field Properties

Every table contains a number of columns called fields or datatypes. Fields are unique pieces of information that make up the information in a table.
Tables usually contain multiple fields.

In a previous example we mentioned that a table might consist of the fields: Last Name, First Name, Phone, Address, City, State, and Zip. Each field
has unique properties. Some contain characters. Others contain numbers. These Field Properties are defined when the table is created.

- 12 -
Understanding Table Relationships

Databases can be simple -- consisting of a single table -- or made up of many different tables. If you were to convert your resume into a database, for
example, you might have a table that contains your name and personal mailing address. We might call this the Contact_Information table.

Your work experience is a different kind of information. Instead of identifying who you are or where you live, it identifies the companies you worked
for, their addresses, your job title, and responsibilities. Because this set of information is independent from the contact information, we might instead
create a second table called the Work_Experience table.

The same is true of your educational background. It has no direct bearing on your contact information or the companies where you worked. A third
table might be created called the Education table to save this kind of data.

The database contains three tables, each independent of the other, and all containing different types of information. The database needs a way to
connect these three tables.

Primary Keys

Every table in Microsoft Access must have at least one field that uniquely identifies each record in the table. This field is known as a primary key.
This primary key essentially opens the door to the table and allows you to retrieve information from the table.

The primary key is the mechanism by which you relate different tables and combine information for viewing (query) or printing (report).

- 13 -
Challenge!

Let us pretend that you are going to start your own home business. You are going to need to prepare a database for your business and the first step is
to design a table that will contain a list of all your contacts that may one day be your clients or suppliers.

Let us assume that a database table called Business Contacts contains all the fields listed in the first column of the following chart. The chart also
contains four other columns:

• Text, Numbers or Both -- should the field accept data entry input in the form of text, numbers, or both?
• Field Size -- the number of spaces you think the field should have.
• Required Entry -- should the field be required entry (the record cannot be added to the database without the information) or optional entry
(a record can be added without entry in the field)
• Allow Duplicates -- should the database allow duplicate entries for the field (e.g., can several people in the database share the same zip
code)?

Practice designing fields by filling out the following table.

Text, Numbers, or
Field Size Required Entry? Allow Duplicates?
Both?
First Name
Last Name
Company
Company Type
Address
City
State
Zip Code
Contact Id
Title
Work phone
Fax Number

- 14 -
Lesson 5: Getting to know the Contact Management database

Objectives

By the end of this lesson, learners should be able to:

• Download a database from the Web


• Open a database in Microsoft Access 2003
• Understand the tables, forms, and reports in the Contact Management database

Download the Contact Management Database

The Contact Management database used in this course can be downloaded from the GCFLearnFree.org® Web site and installed on your computer.

GCFLearnFree.org's Access 2003 lessons all use examples from the Contact Management Database. However, if you'd rather work with another
existing database, you should have little problem following our lessons.

To Download the Contact Management Database:

• Click the link, and download and save the Contact Management database (992k).

(Note, you must have an open connection to the Internet in order to download the database).

• The following dialog box appears:

• Click the Save button.


• You are prompted to save the database in some location on your computer. You will want to save the database in the c:\My Documents
folder.

• Click the Save button to download the database.

Open the Contact Management database

- 15 -
Now that you've downloaded the Contact Management database, let us open and become familiar with it. We will briefly discuss how it was created
and look at some of its database components.

If properly downloaded, the Contact Management database will be present in the c:\My Documents folder on your computer. It is recommended that
you do not move the database from this location until after you have completed the Access 2003 course.

To Open the Contact Management database:

• Open Microsoft Access by selecting its associated icon on the Windows desktop.
• Choose File Open from the menu bar.

• The Look In box in Microsoft Access 2003 defaults to the c:\My Documents when the application is first opened.

If the My Documents folder does not appear in the Look In box, then click in the Look In drop-down box, and locate and select the My
Documents folder.
• Select the Contact Management.mdb file.

• Click the Open button to open the Contact Management database.

The main Contact Management database screen appears on your computer screen:

- 16 -
Reviewing the Contact Management Tables

Tables are found in the database Object called Tables. The Contact Management database contains four tables: Calls, Contact Types, Contacts, and
Switchboard Items.

Reviewing the Contact Management Forms

Forms are found in the database Object called Forms. The Contact Management database has seven forms that are used as both menus and data entry
screens. These forms are Call Details Subform, Call Listing Subform, Calls, Contact Types, Contacts, Report Date Range, and Switchboard. You can
define additional forms to meet your data entry needs.

- 17 -
Reviewing the Contact Management Reports

Reports are found in the database Object called Reports. The Contact Management database has two reports defined to it: Alphabetical Contact
Listing and Weekly Call Summary reports. You can define additional reports in the database depending on your reporting needs.

Challenge!

• If you haven't already done so, download and save the Contact Management database. (Note, you must have an open connection to the
Internet in order to download the database).
• Open the Contact Management database and view each of the following:

o Tables object
o Queries object
o Forms object
o Reports object

- 18 -
- 19 -
Lesson 6: Using a Wizard to Create the Contact Management Database

Objectives

By the end of this lesson, learners should be able to:

• Launch the database wizard


• Create a database using the database wizard tool

Launching the Database Wizard

The Contact Management database was created using the Microsoft Access Database Wizard. We will briefly review the steps involved in creating
this database.

Microsoft Access 2003 is equipped with a database wizard that can be used to create any of ten simple databases: Asset Tracking, Contact
Management, Event Management, Expenses, Inventory Control, Ledger, Order Entry, Resource Scheduling, Service Call Management, and Time and
Billing.

In this lesson we will briefly review the steps involved in creating the Contact Management database.

How the Contact Management Database was Created Using the Database Wizard:

• Choose File New from the menu bar.


• Click once on the Databases tab near the top of the New window.

• If the Templates window does not show, you may need to select On my computer from the task pane on the right side of your screen.

• Click once to select on the Contact Management icon.

- 20 -
• Click the OK button to launch the wizard.

• Specify the location where the database will be saved.

Verifying the Intent of the Contact Management Database

The first screen of the wizard verifies the type of information that will be stored in the Contact Management database: Contact information and Call
information.

• Click the Next button to continue.

Selecting the Tables and Fields to be included in the Contact Management Database

The second screen of the wizard identifies the tables to be created. Three tables were created: Contact information, Call information, and Contact
Types.

Click on any table to display the fields contained to it in the Fields in the table column. Click on a different table and other fields used by that table
will replace the ones displayed for the table selected.

- 21 -
• Accept all other default field selections by leaving those checkboxes marked by a check.
• Click the Next button to continue.

Defining the Format of the Screen Display

The third screen asks the question, What style would you like for screen displays? Microsoft Access provides ten different screen displays for your
use. A thumbnail picture is also provided for each format listed.

• Click through the different format options displayed on the screen -- Blends, Blueprint, Expedition, etc. -- to display a picture of each
format on the left side of the wizard screen. Highlight the desired format -- the Contact Management database used the Standard format --
to be used.
• Click the Next button to continue.

Defining the Format of the Report Display

The third screen asks the question, What style would you like for printed reports? Microsoft Access provides six different report displays for your
use. A thumbnail picture is also provided for each format listed.

- 22 -
• Click through the different format options displayed on the screen -- Bold, Casual, Compact, etc. -- to display a picture of each format on
the left side of the wizard screen. Highlight the desired format -- the Contact Management database used the Corporate format -- to be used.
• Click the Next button to continue.

Naming the Database

The next step is to assign a name to the database.

• Assign a name to the database by typing a file name in the What would you like the title of the database to be field.
• Click the Next button to continue.

Finishing the Wizard

The final step asks whether the database being created is to be opened after it is built by the wizard? It has no bearing whatsoever on the actual
building of the database. If you don't want to open the new database at this point then you can always return to it later and open it in Microsoft
Access.

- 23 -
• Leave or remove the checkmark that appears in the checkbox associated with the Yes, start the database prompt.
• Click the Finish button to initiate the database build.

Challenge!

• Review the Database Wizard screens shown in this lesson. These are the same screens used to create the Contact Management database.
• Open Microsoft Access.
• Choose File and then New from the menu bar.
• Select On my computer... under the Templates section of the Task Pane.
• Select the Expenses database. This is a good example of a database that could be used by a business to track expenses.
• Follow the steps indicated by the wizard to create the database. Make sure the box beside Yes, start the database is checked on the
screen of the wizard.
• Navigate through the database by selecting various forms, tables, etc.

• Save and close the database.

- 24 -
Lesson 7: Opening a Table and Learning to Navigate Records

Objectives

By the end of this lesson, learners should be able to:

• Open a table in Datasheet View


• Navigate through table records and across fields
• Understand the function of the Record Selector field

Opening an Existing Table in Datasheet View

Tables are created and maintained in the Tables tab of the Objects palette in Microsoft Access. The Contact Management database contains four
tables: Calls, Contact Types, Contacts, and Switchboard Items. We will discuss the Contacts table in this lesson.

A table opened in Datasheet View resembles a Microsoft Excel spreadsheet. It is used to input records into the database and will be discussed in this
lesson.

To Open an Existing Table (Contacts) from the Tables Object:

• Open the Contact Management database.


• In the database window, click on the Tables tab from the Object palette.

(If the database window is not displayed, then choose Window Contact Management: Database from the menu bar.)

• To open the table in Datasheet View, double-click the Contacts table in the right window pane.

(You could also either click once on the Contacts form and then click the Open button, or you could right-click on the Contacts form and
select Open from the shortcut menu.

Using the Status Area to Navigate through the Records in a Table

The Datasheet View looks like an Excel spreadsheet. It consists of columns and rows. Field names -- Contact ID, First Name, Last Name, Dear,
Address, City, State, etc. -- appear as column headings. Records represent rows with data input into the fields. The number of rows that appear in the
table will equal the number of records that have been added to the table. One blank row always appears as the last row of the database. This blank
row is used to add a new record the table.

- 25 -
The status area in the lower left area of the window indicates the number of records in the table as well as the record number displayed in the
window.

To Navigate Using the Status Area:

• Click the arrows in the status area to move to the first record, previous record, next record, or last record in the table.
• The new record button displays a blank row into which information for a new record can be added to the table.

Displaying Records by Scrolling Through the Table

The vertical scroll bar is located along the right edge of the screen and can be used to move up or down the table if the total number of records
exceed the records shown on the screen. Similarly, the horizontal scroll bar located at the bottom of the screen can be used to move left or right
across the window if the fields in a table exceed the number of fields displayed on the screen.

Using the Vertical Scroll Bar:

• Click the up or down arrows in the scroll bar to move up or down through the table records.

Using the Horizontal Scroll Bar:


- 26 -
• Click the left or right arrows in the scroll bar to move left or right through the fields in a table.

Using the Keyboard to Navigate Table Records

Another way to navigate records in a table is to scroll up and down one screen at a time using the PageUp and PageDown keys on the keyboard.
Other keys also provide shortcuts to move through fields and records, including:

Key: Selects the:


Tab Next field to the right
Shift + Tab Next field to the left
End Last field of the record
Home First field of the record
Down Arrow Same field in the next record
Up Arrow Same field in the previous record
Page Down Next screen of table records
Page Up Previous screen of table records
Ctrl + End Last field of the last record in the table
Ctrl + Home First field in the first record in the table

The Record Selector

The Record Selector located to the left of each record in Datasheet View identifies the operation being performed against a selected record at any
given time.

The Record Selector can display any of the following symbols:

• indicates the current record. The record is saved with the information displayed on the screen.
• indicates the selected record is being edited and the changes have not yet been saved.
• indicates a blank record into which information for a new record can be added to the table.

A blank record row always appears as the last row in a table. You must add new table records using this row.

Challenge!

• Open the Contact Management database.


• Open the Contacts table in Datasheet View.
• Click through each of the following buttons in the Status Area: Next Record, Last Record, Previous Record, and First Record.
• Practice scrolling through the table using the horizontal and vertical scroll bars.
• Take a screen print of the window showing the horizontal and vertical scroll bars.
• Practice using the keyboard to navigate through table records. Notice how the cursor moves from record to record for each of the following
keys:
o Tab
o Shift + Tab
o End
o Home
o Page Down
o Page Up
o Down Arrow
o Up Arrow
o Ctrl + End
o Ctrl + Home

- 27 -
Lesson 8: Viewing and Adding Table Records

Objectives

By the end of this lesson, learners should be able to:

• Add a table record in Datasheet View


• Resize table columns
• Adjust row heights

Enter/Add a Table Record in Datasheet View

Each record in a table is represented by a row. Field names are represented as columns in the table. To add a new record, navigate to the last row in
the table -- it is a blank row -- or click the new record button in the Status Area. Then, input the requested information into each field in the new
record. In this lesson, you will add a new record to the Contact Table.

To Enter/Add a Table Record in Datasheet View:

• If not already displayed, open the Contacts table in the Contact Management database.
• Click on the New Record button to display a blank row for data entry.
• Moving left to right across the screen, type the requested information into each field of the record. If the field label reads, First Name, type
the first name of the individual being entered into the table.
• Press the Tab key to move from one field to the next, or left-click with your mouse in the next field.

• Complete entries in the remaining form fields: Last Name, Company, Address, City, State/Province, Postal Code, Country, Title, Work
Phone, Work Extension, Mobile Phone, Fax Number, Contact Type, Email Name, Referred By, and Notes pertaining to the contact.
• Press the Tab key at the last column to start another record, or click the New Record button again.

Saving Your Work: Information in a table is saved automatically when the mouse, an arrow key, the Tab key, or the Enter key is used to move
the cursor out of that row and into a different record.

You can manually save data being entered for a record as you work your way across the different fields in the record -- there are many fields in the
record. Choose Records Save on the standard toolbar to save data without moving the cursor out of the record's row.

Resizing table columns

Adjusting a column width in Access is similar to Microsoft Excel. By default, each column in Access is 15.6667 characters wide. Each individual
column can be enlarged to 363 characters wide.

When entering records, you may need to resize columns to view the information as it is being typed. The width of an address column, for example,
might be smaller than the actual address. You can adjust the column width of any field so it is wide enough to view the complete field entry.

In Access, you can adjust column width manually, use AutoFit, or use the menu bar.

Manually adjust a column width:

• Place your mouse pointer to the right side of the gray column header.
• The mouse pointer changes to the adjustment tool (double-headed arrow).

- 28 -
• Drag the Adjustment tool left or right to the desired width and release the mouse button.

Resizing table columns (continued)

Adjusting the Column Width Using the Menu Bar:

• Click anywhere in the column where the column width is to be changed.


• Choose Format Column Width on the standard toolbar.
• Type a new specification in the Column Width field.
• Click the OK button to accept the change.

AutoFit the column width:

• Place your mouse pointer to the right side of the column header.
• The mouse pointer changes to the adjustment tool (double-headed arrow).
• Double-click the column header border.
• Access "AutoFits" the column, making the entire column slightly larger than the largest entry contained in it.

To access AutoFit from the menu bar, choose Format Column Width, and then check the Best Fit checkbox.

Adjusting row height

Each row in Access defaults to a height of 12.75 but can be enlarged to 1638. Changing the height of a row is similar to adjusting a column width
with two exceptions: 1) a row height change applies to all the rows in a table, and 2) auto-fit is not available at the row level.

To Adjust the Row Height:

• Choose Format Row Height on the standard toolbar.

- 29 -
• Type a new specification in the Row Height field.

• Click the OK button to accept the change.

Saving Your Work: If you changed the table layout, you will be prompted to save the changes when you exit Microsoft Access.

Challenge!

• Open the Expenses database you created with the database wizard in lesson 6.
• Open the Employees table in Datasheet View and input the following records in the proper fields:

o Joe Smith, 44 Highhouse Road, Cary, NC 27513, United States, 111-11-1111 (Social Security Number), 40 (Employee Number),
Salesperson (Title), 919-555-1212 (Work Phone), and 100 (Extension).
o Jane Allen, 123 Atlantic Avenue, Raleigh, NC 27516, United States, 222-22-2222 (Social Security Number), 56 (Employee
Number), Director of Sales (Title), 919-555-1234 (Work Phone), and 200 (Extension).
o Pete Moss, 567 Helix Court, Raleigh, NC 27606, United States, 333-33-3333 (Social Security Number), 75 (Employee Number),
Clerk (Title), 919-555-5678 (Work Phone), and 300 (Extension).
• Resize the Social Security Number column using the menu bar method.
• Resize the Employee Number column using the manual adjust method.
• Resize the State/Province column using the auto-fit method.
• Save and close the document

- 30 -
Lesson 9: Editing and Deleting Table Records

Objectives

By the end of this lesson, learners should be able to:

• Edit a field in a table record in Datasheet View


• Cut, copy, and paste table records
• Use the Undo feature
• Check the spelling of data
• Delete table records

Editing a Table Record in Datasheet View

Information in a record is likely to change over time, when someone moves from one address to another, or when someone else changes his or her
phone number. Information can be changed in any field of any table record.

To Edit a Single Word in a Field:

• Move the mouse over the field you want to edit. The mouse pointer changes to an I-beam.
• To add characters to the field information (e.g., a letter needs to be added to a word), click once in the field at the spot where the
information needs to be changed. An insertion point | appears.
• To overwrite a word in the field (e.g., "Road" needs to change to "Street"), double-click (or click-and-drag across the word) on the word
in the field. Type the new information directly over the highlighted word.

To Edit an Entire Field:

Sometimes, you will need to change the entire contents of a field (e.g., someone has a new address). In Access, you can select an entire field for
editing.

• Move the mouse pointer to the left edge of the field you want to edit.
• The mouse pointer changes to a selection tool, a large cross.
• Click to select the field.
• Type the new information.

Warning! When attempting to edit an entire field, be careful not to move the mouse pointer so far to the left that you click on the Record
Selector (pointer changes to an arrow pointing right) and select the entire record. In Access, you cannot edit fields when the entire record selected.

Saving Your Work: Unlike the Word, Excel, or PowerPoint applications, you will not be prompted to save the data you entered when you exit
the screen or close application. In Access, each record is saved automatically when you move to another record.

Cutting, Copying, and Pasting Table Records

Cut, Copy, and Paste are very useful operations in Microsoft products, including Access 2003. These operations allow you to quickly copy and/or
cut information in fields for pasting into other fields. These operations save you a lot of time from having to type and retype the same information.

The Cut, Copy, and Paste buttons are located on the Standard toolbar.

The Cut, Copy, and Paste operations also appear as choices in the Edit menu:

- 31 -
The Cut, Copy, and Paste operations can also be performed through shortcut keys:

Cut Ctrl + X
Copy Ctrl + C
Paste Ctrl + V

Cutting, Copying, and Pasting Table Records (continued)

To Cut Data from a Table:

• Select the data that is to be cut from the table.


• Click the Cut button on the Standard toolbar, or press the Ctrl + X shortcut keys, or choose Edit Cut from the standard toolbar.

To Copy Data in a Table:

• Select the table data that is to be copied.


• Click the Copy button on the Standard toolbar, or press the Ctrl + C shortcut keys, or choose Edit Copy from the standard toolbar.

To Paste Data in a Table:

• Perform either a cut or copy operation on the selected data.


• Position the mouse pointer over the field where the information is to be pasted.
• Click the Paste button on the standard toolbar, or press the Ctrl + V shortcut keys, or choose Edit Paste from the standard toolbar.

Using the Undo Feature

There might be occasions when you do something to a table -- type the wrong number in a cell, for example -- that you didn't mean to do.
Fortunately, you can undo an operation in Access 2003. The Undo operation recovers the last single action performed.

Certain rules govern use of the Undo feature. First, the record needs to be edited in Datasheet View. Also, Undo becomes unavailable when:

• A different field is edited (Undo of the last field edit cannot be performed).
• A different record is edited (Undo of the last saved record cannot be performed).
• A different window is displayed.
• A filter is applied or removed (filters are discussed in a later lesson.)
- 32 -
To Undo the Last Change to the Current Field, use one of the following methods:

• Click the Undo button on the Standard toolbar.


• Choose Edit Undo Current Field/Record from the menu bar.
• Press the Esc key on the keyboard.

Check the Spelling of Data

Spelling data correctly in Microsoft Access is essential. Sloppy data-entry work -- the customer name Smithsson is mistakenly typed when the name
is actually Smithson -- can potentially leave the contact out of future queries or reports. The Spelling Check feature searches for spelling errors in a
table, form, or query. In a table, Spelling Check specifically checks the spelling of records, fields, or text within a field.

To Check Spelling in a Table:

• Click on the Spelling button , or choose Tools Spelling from the menu bar, or press the F7 shortcut key. The Spelling dialog box
opens.

• Access provides an alert whenever a word is found that is not in the Dictionary file. The unrecognized word is displayed in the Not in
Dictionary text box.
• Correct the word either by performing any of the following actions:

• Type the correct word in the Change To field


• Click the Ignore button to ignore the change and move to the next word
• Highlight the correct word from a list of Suggestions and click the Change button
• Click the Add to add the word to the custom dictionary.

• A notification dialog box is opened when Access completes the spelling check. Click the OK button to close the dialog box.

Deleting Table Records

One or more table records can be deleted from an Access table at any time while in Datasheet View.

To Delete a Table Record:

• Locate the record to be deleted.


• Click the Record Selector to the left of the record's first field to select the entire record.

• Press the Delete key or click the Delete Record button on the toolbar.
- 33 -
• A dialog box is displayed to confirm that the record is to be deleted. Click the Yes button to complete the delete operation.

Deleting Table Records (continued)

To Delete Multiple Consecutive Table Records:

• Click the Record Selector to the left of the first record to be deleted, and then drag the cursor up or down across multiple Record Selectors
to select consecutive records.

(or hold the Shift key and click the Record Selector field in each consecutive record to be marked for delete.)

• Press the Delete key to mark the records for delete, click the Delete Record button, or choose Edit Delete from the menu bar.
• A dialog box is displayed to confirm the record(s) to be deleted. Click the Yes button to complete the delete operation.

Important to Remember:

Deleting records is permanent. It cannot be reversed through an Undo operation. Use caution when the dialog box is displayed to confirm the
record(s) to be deleted.

Challenge!

 Open the Expenses database you created.


 Edit the Jane Allen record by changing the word "Avenue" in the Street Address to "Road."

 Navigate to the Joe Smith record, cut the City entry and then type "Apex" as the new City.
 Copy Jane Allen's Work Phone and paste it in Pete Moss's Work Phone.
 Delete the Joe Smith record
 Save and close the document.

- 34 -
Lesson 11: Editing Form Records

Objectives

By the end of this lesson, learners should be able to:

• Locate an existing form record


• Edit a form record

Using the Status Area to Navigate through Records in a Form:

Contact records need to be updated whenever information changes. Changes occur when people move from one address to another, switch
companies, or change phone numbers. In the Contact Management database, you can change this information using the Contacts form.

Navigating through records in a form works very much like navigating through records in Datasheet View. The Form View window contains a
status area in the lower left corner. Use the arrows to navigate through the forms.

• Click the arrows in the status area to move to the first record, previous record, next record, or last record in the table.
• The new record button displays a blank form into which information for a new record can be added to the table.

Use the keyboard to navigate the fields in a form.

Key Selects the


Tab Next field to the right
Shift + Tab Next field to the left
Down Arrow Field below the current record
Up Arrow Field above the current record

Editing Form Records

Information will undoubtedly change in your database. Contacts move to a different address, change their telephone numbers, or switch companies.
You can either change the information for any of these records, or, if no longer needed, even delete the record from the database.

Editing a form record in Access is very easy. It entails locating the record and then typing the corrected information in the appropriate field.

To Edit a Form Record:

- 35 -
• Using the status area to navigate the forms, display the form record that is to be edited.

• Either click in a field or use the keyboard to navigate to the first field to be changed or added.

• Type the new information or correct the information in the selected field.
• Navigate to the next field that needs to be corrected and make any necessary changes.
• When finished editing information on this page, click the Page 2 button to display additional fields.

In the previous lesson, we saw how to enter new Contact Types on the Contact Types form. These entries are now available for use in the Contact
Type field of the Contacts form.

• Click on the drop-down button associated with Contact Type. If you successfully completed the challenge in the last lesson, this drop-down
list now contains several entries: Family, Friend, Relative, Work, Recruiter, Company, and Network.

Saving Your Work: After you input the data into a form record, Access automatically saves the record when you use the mouse, an arrow
key, the Tab key, or the Enter key to move the cursor out of that field and into a different field, or record.

Remember, you can always add records to the Contact Types table while in Datasheet View. First, click on the Tables tab from the Object
palette of the database window. Then double-click the Contact Types table to open the table in Datasheet View.

Challenge!

• Open the Contact Management database.


• Display the Contacts form and use the Status area to display each record shown.
• Change the Contact Type of each contact record to that indicated below:
o Assign a "Company" Contact Type for the John Smith record
o Assign a "Friend" Contact Type for the Michelle George record
o Assign a "Friend" Contact Type for the Martha Brinson record
• Add make-believe Mobile Phone numbers and Email Name for any record(s) missing this information.
• Display the John Smith record.
o Click the Calls button on the Contacts form to open the Calls table.
o In the Subject field, type: "Redesign"
o In the Call Notes field, type: "Reviewed possible plant redesign. Waiting for quote."
• Save and close the database.

- 36 -
- 37 -
Lesson 12: Sorting Records

Objectives

By the end of this lesson, learners should be able to:

• Review table records and form records concepts


• Perform a simple sort
• Perform a multi-field sort
• Remove a sort
• Save a sort

Sorting Records to Find Information

Sorting is one method that helps you find information quickly and easily in a database. Records can be sorted in ascending order (A-Z), and
descending order (Z-A). You can sort by zip code, last name, first name, company, contact type (e.g., family, friend, relative), etc. You can even
sort by contact type and then by last name within each contact type.

It's easiest to see the results of a sort if you work in Datasheet View.

To Sort Records:

• Open the desired form or table (e.g., Contacts table).


• Choose View Datasheet View from the menu bar if Datasheet View is not already displayed.

• Click anywhere in the column you want to sort by (e.g., Last Name).
• Click the Ascending or Descending button on the toolbar (or choose Records Sort Sort Ascending or Sort Descending from the
menu bar).

To sort by Form View, switch to Form View, select the field you want to sort by, and click the Sort button on the toolbar. To see the results, use
the status area to move through the records.

Performing a multi-field sort

Multi-field sorting allows you to define multiple fields in your sort. You specify the column to sort by, (e.g., Last Name), and within that column
sort by some other specified field (e.g., First Name). For example, you could sort all the Brown records by first name.

To Sort by Multiple Fields:

- 38 -
• Open the desired form or table in Datasheet View.
• Move the columns to be included in the sort so they are positioned alongside one another.

Moving a column in Access is much like moving a column in Excel. Click in the column heading of one field to highlight the entire column.
Then, drag the entire column so that it sits alongside the other column(s) to be used in the sort.

• The column to be sorted first should be positioned to the left of the second column to be sorted, and so on.

• Select all fields (columns) involved in the multiple sort process.

• Click the Ascending or Descending button on the toolbar to sort the records (or choose Records Sort Sort Ascending or Sort
Descending from the menu bar).

Multiple field sorts cannot be performed in Columnar or Tabular Form View.

Removing a Sort

After a sort is performed, you will be given the option to save the sort or to remove it to allow the records to return to the way they were ordered
before you applied the sort.

To Remove the Sort Order:

• Choose Records Remove Filter/Sort from the menu bar.

- 39 -
The records revert to their ordering before the sort was applied.

If you add new records to a table that has been sorted, any new records are automatically saved.

Saving a sort

When you open a table in Access -- any table -- the records are displayed in order based on values that appear in the primary key field. In other
words, Access defaults to a sort on the primary key when a table is opened. A sort can be performed against any field listed in a table, however.
Sorting table records actually change the table design. When you attempt to close a table after a sort, Access will prompt you to save the changes to
the table design.

To save a sort:

• Exit the table


• Click the Yes button in response to the question, Do you want to save changes to the table?

The sort order is saved. When you open the table again, the records will still be sorted.

To cancel a sort:

• Exit the table


• Click the No button in response to the question, Do you want to save changes to the table?

The change is not saved; the table remains in its original design.

Challenge!

• Open the Contact Management database.


• Open the Contacts table in Datasheet View.
• Perform the following single-field sorts:

o Sort (descending or ascending) the records by the Last Name field.


o Sort (descending or ascending) the records by the State/Province field.
o Sort (descending or ascending) the records by the Contact ID field.

• Perform the following multi-field sorts:

o Move the City field to the right of the State field and sort (descending or ascending) the records by State and City.
o Move the City field to the right of the Last Name field and sort (descending or ascending) the records by Last Name and City.

• Remove the last sort performed


• Cancel the sort when you close the Contacts table, and click the NO button in response to the Do you want to save changes to the design
of table 'Contacts' system prompt.

- 40 -
Lesson 13: Finding Records

Objectives

By the end of this lesson, learners should be able to:

• Perform a simple find


• Use a wildcard to find a record

Performing a Simple Find

When you have an extremely large database consisting of thousands of records, you may need to quickly locate one of them. Access provides an easy
way to find individual records: the Find function.

To use the Find Function:

• Click anywhere in the field that contains the data you want to search (e.g., Last Name).
• Choose Edit Find on the menu bar or click the Find button on the toolbar to open the Find and Replace dialog box.
• In the Find What field, type the information you want to search. It may be a last name (e.g., Manning) or a portion of the last name (e.g.,
Man).

• The Look In drop-down box defaults to the field or column where the cursor was positioned when the Find was initiated. You can leave
the definition as is if you know the information is contained in this field, or you can select search the entire table from the drop-down menu
list.

• In the Match field, Access defaults to Whole Field but you can optionally select either Any Part of Field or Start of Field.

• Click the Find Next button to search for the first occurrence of a record that matches the search.

Performing a Simple Find (continued)

• Click the Cancel button if the record was found. The Find and Replace dialog box will close.

OR

• Click the Find Next button to search for the next record that meets the Find criteria.

In the event that Access did not find a match for the search, the Office Assistant will pop up to inform you that there were not any matched records
found.

- 41 -
Using Wildcards to find records

If the simple Find did not find the record you sought then you can try typing an operator in the Find What text box of the Find and Replace dialog
box. A common Access operator is a wildcard, a symbol representing one or more characters.

Wildcard Usage Example

* (Asterisk) Used at the beginning or the end of a search string to match one or Sch* finds Schlotz and Schwartz. *ing finds Wheeling
more characters and Browning.

? (Question Mark) Matches any single alphabetic character Sp?ll finds spell and spill.

# (Pound Sign) Matches any single numeric character 9#1 finds 901, 911, 921, etc.

To Search for a Record Using a Wildcard:

• Choose Edit Find on the menu bar or click the Find button on the toolbar to open the Find and Replace dialog box.
• In the Find What field, type the wildcard combination (e.g., B*) to find the first record where the Last Name begins with the letter B.

• Click the Find Next button to begin the search. The first record found that matches the search is highlighted.

(The Office Assistant will provide notification if no matching records were found).
• Click the Cancel button if the record was found. The Find and Replace dialog box will close.

OR

• Click the Find Next button to search for the next record that meets the Find criteria.

Challenge!

• Open the Contact Management database.


• Open the Contacts table in Datasheet View.
• Perform a Find Next function against the Contacts:Table Look In field to locate the William Henderson record.
• Perform a Find function against the Contacts:Table Look In field and using an A* wildcard combination to locate the first record.
• Perform and repeat a Find Next function against the same wildcard combination as you move your way throughout the records in the
database.
• Close the Contacts table and, if displayed, click the NO button in response to the Do you want to save changes to the design of table
'Contacts' system prompt.

- 42 -
Lesson 14: Filtering Records

Objectives

By the end of this lesson, learners should be able to:

• Perform a Filter By Selection


• Remove a Filter
• Perform a Filter Excluding Selection
• Perform a Filter By Form

Performing a Filter by Selection

At times, you might want to view only those records that match a specific criterion. A filter is a technique that lets you view and work with a subset
of data. Applying a filter to an Access table, form, or query temporarily hides records that don't meet your search criteria. For example, you may
only want to work with data pertaining to a specific zip code.

To Filter By Selection:

• Click anywhere in the field that you want to filter the records in the table.

• Click the Filter by Selection button in the standard toolbar or choose Records Filter Filter By Selection from the menu bar to apply
the filtering.

• The filter produces a display that shows only those records that match the filter's definition (e.g., North Carolina). The status area reflects
only the filtered records.

Removing a Filter

To Remove a Filter:

- 43 -
• Click the Remove Filter button on the standard toolbar or choose Records Remove Filter/Sort from the menu bar.

• The records revert to their ordering before the sort was applied.

• Optional, if you wish to reapply the filter, click the Apply Filter button (This button acts like a toggle to turn the filter on and then turn the
filter off).

Saving a Filter

Access defaults to displaying all records in a table. Filters are not applied to the table initially. Filtering table records actually change the table design.
When you attempt to close a table after a filter, Access will prompt you to save the changes to the table design.

To save a filter:

• Exit the table.


• Click the Yes button in response to the question, Do you want to save changes to the table?

The filter order is saved.

When you open the table or form later, all the records will be visible. Click the Apply Filter button to reapply the filter. However, Access saves
only the last filter you create.

You can apply filters to filtered data to narrow your search even further.

To cancel a filter:

• Exit the table


• Click the No button in response to the question, Do you want to save changes to the table?

The change is not saved; the table remains in its original design.

Performing a Filter Excluding Selection

The Filter Excluding Selection works in the opposite manner as the Filter by Selection. Instead of specifying the filter to be used to view records
(e.g., everybody in North Carolina), Filter Excluding allows you to view data that does not include the specified criterion (e.g., everybody not in
North Carolina).

To Apply Filter Excluding Selection:


- 44 -
• Click anywhere in the field that is to be excluded from the filter.

• Choose Record Filter Excluding Selection from the menu bar or right-click and choose Filter Excluding Selection from the shortcut
menu.

• All records except the criterion you excluded are now visible.

• The status area shows only the filtered records displayed on the screen.

Remove this filter by clicking the Remove/Apply Filter button.

Performing a Filter By Form

The Filter by Form feature is used when you are working in Form view and not in Datasheet View. Filter by Form works the same way as the Filter
by Selection method, except the filtering is defined on a blank contact data entry form as if you were creating a new contact record.

To Filter by Form:

• In Form View or Datasheet View, click the New Record button to create a blank form or datasheet.

• Click the Filter By Form button in the standard toolbar.


• When you click in a field (e.g., State/Province), a drop-down list is opened and displays all the criteria (filter values) available for
selection.

• Select a filter value from the drop down list (e.g., North Carolina, to view all records in North Carolina).

- 45 -
• To display records meeting more than one search criteria, click the Or tab located at the bottom of the screen. Otherwise, continue to the
next step.

• Click the Apply Filter button to apply the filter and view the filtered records.

Challenge!

• Open the Content Management database.


• Open the Contacts table in Datasheet View.
• Filter by Selection on any record that reveals a City of "Apex."
• Remove the filter.
• Perform a Filter Excluding Selection on any record that reveals a City of "Raleigh."
• Remove the filter.
• Filter By Form on the City of "Raleigh."
• Remove the filter.
• Close the Contacts table, and if displayed, click the NO button in response to the Do you want to save changes to the design of table
'Contacts' system prompt.

- 46 -
Lesson 15: Running Database Queries

Objectives

By the end of this lesson, learners should be able to:

• Run an existing query


• Create a Single-table query
• Create a Multiple-table query

Run an Existing Query

Like tables and forms, a query is another type of database object in Access 2002 XP. A query is a search for records that match the exact criteria
you define. In this example, we will run a query against the Contacts table and list all records found by Last Name, First Name, and Work phone.

To Run an Existing Query:

• Open the Contact Management database.


• In the database window, choose the Queries tab from the Object palette.
• To open a query, double-click the query title, or click once on the query title and then click the Open button, or right-click the title and
choose Open from the shortcut menu.

• The query searches the database and then displays the results on the screen.

Creating a Single Table Query

In this example, we will create a new query and run it against that very same Contacts table. We will type the following command in the table: Show
me the mailing address of all records in the Contacts table. When we create the query, we need to select the following fields in the Contacts table:
Last Name, First Name, Address, City, State/Province, and Postal Code.

To Create a Simple Query:


- 47 -
• Open the Contacts Management database.
• In the database window, choose the Queries tab from the Object palette.
• Select the Create query by using wizard option and click the Open button .

• The Simple Query Wizard opens.

• From the Tables/Queries drop-down list, choose the table/query containing the fields you want to include in the query.

Creating a Single Table Query (continued)

• The Available Fields text box displays all the fields contained in the table selected in the Tables/Queries field. You are to select the fields
to be used in the new query. You can pick one or more, or even all fields in the query.

- 48 -
Click to highlight the first field to be included in the query -- Last Name, for example -- and then click the right arrow button. Repeat until
you have selected all fields to be used (First Name, Address, City, State/Province, and Postal Code).

• If the fields you selected include a number field, you are asked to select a summary or detail query. To see each record, choose Detail. To
see sums, averages, etc., choose Summary and set the summary options. Click the Next button.
• Type a name for the query (e.g., Contacts Mailing Address) in the What title do you want for your query? field.

(Leave the Open the query to view information radio button turned on).

• Click the Finish button to run the query.

Creating a Multiple-table Query

Queries are not confined to just a single table. You can create a query that runs against multiple fields in multiple tables. This query is created in an
identical manner to the single-table query defined on the previous page. The only difference when creating a multiple-table query is that after
selecting the fields in one table, as we saw in the last example, you then select the next table and choose additional fields.

In this query, we will ask for the name, contact type, and phone number of all records in the Contacts table. When we create the query, we will select
fields from two tables: Contacts table (Last Name, First Name, and Work Phone fields) and Contacts Type table (Contact Type field).

To Create a Multiple-table Query:

• Open the Contacts Management database.


• In the database window, choose the Queries tab from the Object palette.
• Select the Create query by using wizard options and click the Open button .
• The Simple Query Wizard opens.
• From the Tables/Queries drop-down list, choose the first table where you would like to perform the query (e.g., Contacts).

- 49 -
• From the Available Fields, select the fields to be included from this table (e.g., Last Name, First Name, and Work Phone).

Creating a Multiple-table Query (continued)

• Select the next tables or query from the Tables/Queries drop-down list and pick the fields in that table in which you would like to perform
the query.

• Type a name for the query (e.g., Contacts by Contact Type) in the What title do you want for your query? field.

• Click the Finish button to run the query.

Sorting, Finding, and Filtering Query Results

Throughout this lesson, we have learned several different ways to quickly locate information in the Contact Management database: sort records
(lesson 12), find records (lesson 13), filter records (lesson 14), and queries. Can you run a query and then sort, find, or filter records? Absolutely.
This is the power of a database.

Everything that you previously learned about how to save sorts and filters applies to queries as well. Once a query is defined, you can come back into
the database at any time -- even after new contact records have been added -- and run that query.

After you run a query and defined a sort, you will be asked to save the sort and the query design when you close the query or exit Access. If you save
those changes, the sort will be saved to the query the next time you run the query. If you do not save the changes, the query returns to the original
order the next time you run it.

- 50 -
When a filter is applied to a query, Access will ask if the changes to the query design are to be saved the next time you close the database or exit
Access.

• An answer of yes will save the filter but not the filtered query. The next time the query is run, all records that match the query are visible.
• To apply the saved filter, click the Apply Filter button to reapply the filter. Remember, Access saves only the last filter you create.

Challenge!

• Open the Contact Management database.


• Open the Contacts table in Datasheet View.
• Use the Wizard to create a Single-table Query:

o Select the Contacts table.


o Select the following fields in the Contacts table: Last Name, First Name, Address, City, State/Province, Postal Code, Work
Phone, Work Extension, and Email Name.
o When prompted to name the query, call it "Address Book Contacts."

• Use the Wizard to create a Multiple-table Query:

o Select the following fields in the Contacts table: Last Name, First Name, Company Name, Work Phone, and Work Extension.
o Select the following fields in the Calls table: Call Date, Subject, and Notes.
o Select a Detail query.
o When prompted to name the query, call it "Job Search Progress."

• Build onto the Sorting, Finding, and Filtering capabilities learned in previous lessons by applying these techniques on the queries that you
have created in this Challenge!
• Close the Contacts table, and if displayed, click the NO button in response to the Do you want to save changes to the design of table
'Contacts'? system prompt.

- 51 -
Lesson 16: Running and Printing Database Reports

Objectives

By the end of this lesson, learners should be able to:

• Run Contact Management database reports


• Create a report using AutoReport
• Create a report using the Report Wizard

Running Contact Management Reports

The Contact Management database contains two reports that you can use to print a complete list of contacts in the database (Alphabetical Contact
Listing Report), as well as a call log to recap phone-call summaries made between any two dates (Weekly Call Summary Report).

To run the Alphabetical Contact Listing Report:

• On the Main Switchboard form, click once on the Preview Reports menu selection.
• On the Reports Switchboard, click once on the Preview the Alphabetical Contact Listing Report menu selection.

• The Alphabetical Contact Listing Report is displayed.

The Contact Management reports can also be run in Datasheet View by selecting the Reports tab from the Object palette of the database
window. Then double-click on the Alphabetical Contact Listing report.

Running Contact Management Reports (continued)

- 52 -
To run the Weekly Call Summary Report:

• On the Main Switchboard form, click once on the Preview Reports menu selection.
• On the Reports Switchboard, click once on the Preview the Weekly Call Summary Report menu selection.

• In the Weekly Call Summary dialog box, type the date range in the Begin Call Date and Ending Call Date fields. This lets you search the
database for calls made between two defined dates.

• The Weekly Call Summary Report is displayed

Creating a Report using AutoReport

The reports object in Access allows you to create a report to present your data in a meaningful and attractive printout. One way to create a report in
Access is to use AutoReport. This report format quickly generates a columnar or tabular report format for records in a selected table.

To Create an AutoReport:

• Open the database window and choose the Reports selection from the Objects palette.

• Click the New button to open the New Reports dialog box.

• Choose either the AutoReport: Columnar (prints one record in columnar format) or the AutoReport: Tabular options (prints all records
in tabular format.)

- 53 -
• Click the drop-down list and choose the table or query on which the report or query is based.

• Click the OK button to create the report and open it in Print Preview. (The mouse pointer changes to a magnifying glass. Remember, you
cannot edit data in Print Preview.>

Columnar Report Example:

Tabular Report Example:

- 54 -
After you have created a report, you will be asked to save the report when you close it or exit Access. When you save a report, only the structure
of the report is saved and not the underlying data seen in print preview.

Creating a Report Using the Report Wizard

Another way to create reports in Access is to use the Report Wizard. The Report Wizard asks a series of questions that you must answer. Access
uses your responses to create the report.

To Create a Report using the Report Wizard:

• Open the database window and choose the Reports option from the Object palette.
• Click the New button to open the New Reports dialog box.
• Click on the Report Wizard selection.

• Click the drop-down list and choose the table or query on which the report or query is based.

• Click the OK button to begin the Report Wizard.

Creating a Report Using the Report Wizard (continued)

In the Report Wizard's first dialog box,

- 55 -
• Choose the table or query in which you would like to base the report.
• Highlight the first field from the Available Fields that will be included in the report and click the right arrow to move the field to the
Selected Fields box.
• Repeat so that each field is included in the report, or the click the double arrow to move all the fields for the report.
• When finished, click the Next button.

In the Report Wizard's second dialog box, you can select a field name for grouping purposes. For example, by selecting First Name, notice how First
Name becomes the group header (blue text) in the right side of the picture. You do not have to select any grouping levels.

• Highlight the field that you would like to use as a group level, and click the right arrow to move the field to the Selected Fields box.
• When finished or to bypass this screen, click the Next button.

Creating a Report Using the Report Wizard (continued)

In the Report Wizard's third dialog box, you can specify how or if the reports are to be sorted on the report. For example, if you wanted to show
names alphabetically and by state, you would first sort by State and then by Last Name.

- 56 -
• In the first field (optional), select a field name from the drop-down box only if records in the report are to be sorted by that field. Then,
click the button to define whether records are to be sorted in ascending or descending order.
• If necessary, repeat for each of the remaining three sort fields.
• When finished or to bypass this screen, click the Next button.

In the Report Wizard's fourth dialog box,

• Select one of the three listed Layout options: Columnar, Tabular, or Justified.
• Select an Orientation for the report, either Portrait or Landscape.
• (Optional), select or deselect the Adjust the field width so all fields fit on a page field.
• Click the Next button to continue.

Creating a Report Using the Report Wizard (continued)

In the Report Wizard's fifth dialog box,

- 57 -
• Click through the different format options displayed on the screen -- Bold, Casual, Compact, etc., to display a picture of each report format
on the left side of the wizard screen. Highlight the desired format you would like to use.
• Click the Next button to continue.

In the Report Wizard's sixth dialog box,

• Assign a name to the report by typing a file name in the What title do you want for your report? field.
• Click the Finish button to complete the wizard and generate the report.

You can decide to include any or all of the Report Wizard's selections in your report.

Very Important! When working in tables, forms, queries, and reports, use the New Object button on the toolbar to create new database objects
(tables, forms, queries, reports).

Using Print Preview

- 58 -
When your report opens in Print Preview, it is usually displayed at 100%. However, to get a better look at various report features, you may need to
resize your window.

Viewing a Report using the Print Preview Toolbar:

• In Print Preview, your mouse pointer is the Zoom tool (magnifying glass), which allows you to "zoom" in and out. Click on the document
(or the Zoom button on the toolbar) to "zoom" in for a closer look. Notice Print Preview's drop-down menu reads "100%."
• Click again on the document (or the Zoom button) to "fit" the document to the Print Preview window.
• Use the Resize drop-down menu to further resize your document.

• Use the display buttons to display one or more pages.

• Click the Database window button to bring the database window to the front.
• Click the Officelinks button to "Publish it with Word" or "Analyze it with Excel". Clicking either of these choices will allow you to
print your document as a Word or Excel document.

• For Help, click the question mark.


• Click the Close button to close your report and return to the database window.

Printing a Report

Any report in the Contact Management database can be outputted to a printer of your choice.

To Print a Report from Print Preview:

• Click the Print button on the Print Preview toolbar to print your document (the Print dialog box will not open).

To Print a Report using the Menubar or Toolbar:

- 59 -
• Choose File Print from the menu bar to open the Print dialog box.

• Make any necessary changes to the Print Range, Copies, or Zoom sections of the Print dialog box.

• Click the OK button to print the report.

Print Preview and Print are fully explained in the Office 2002 XP course.

Challenge!

• Open the Contact Management database.


• Open the Contacts table in Datasheet View and Print all the records in the table.
• Open the Calls table in Datasheet View and Print all the records in the table.
• Open the Contact Types table in Datasheet View and Print all the records in the table.
• Open the Main Switchboard form.
• Run the Alphabetical Contact Listing Report and then Print the completed report.
• Run the Weekly Call Summary Report and then Print the completed report.
• Create a report using AutoReport:
• Create a columnar report against the Calls table.
• Print the completed report.
• Close the report and click the NO button in response to the Do you want to save changes to the design of report 'Report1'? system
prompt.
• Create a report using the Report Wizard:
• Select the Calls table.
• Select the following fields in the Calls table: Contact ID, Call Date, Subject, and Notes.
o Do not add any grouping levels.
o Do not define any sorting.
• Keep the Layout and Orientation default settings.
• Pick a Style of your choosing.
- 60 -
• Name the report "Job Search Progress."
• Print the completed report.

- 61 -

You might also like