0% found this document useful (0 votes)
108 views142 pages

C - Manuals - Access - Access 2013 Part 2 PDF

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views142 pages

C - Manuals - Access - Access 2013 Part 2 PDF

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 142

STUDENT EDITION

®
Microsoft Office
®
Access 2013:
Part 2
Microsoft® Office
Access® 2013:
Part 2
Microsoft® Office Access® 2013: Part 2
Part Number: 091005
Course Edition: 2.2

Acknowledgements
PROJECT TEAM

Author Media Designer Content Editor

Sharon Behrens Alex Tong Catherine M. Albano

Notices
DISCLAIMER
While Logical Operations, Inc. takes care to ensure the accuracy and quality of these materials, we cannot guarantee their
accuracy, and all materials are provided without any warranty whatsoever, including, but not limited to, the implied warranties of
merchantability or fitness for a particular purpose. The name used in the data files for this course is that of a fictitious company. Any
resemblance to current or future companies is purely coincidental. We do not believe we have used anyone's name in creating this
course, but if we have, please notify us and we will change the name in the next revision of the course. Logical Operations is an
independent provider of integrated training solutions for individuals, businesses, educational institutions, and government agencies.
Use of screenshots, photographs of another entity's products, or another entity's product name or service in this book is for editorial
purposes only. No such use should be construed to imply sponsorship or endorsement of the book by, nor any affiliation of such
entity with Logical Operations. This courseware may contain links to sites on the internet that are owned and operated by third
parties (the "External Sites"). Logical Operations is not responsible for the availability of, or the content located on or through, any
External Site. Please contact Logical Operations if you have any concerns regarding such links or External Sites.

TRADEMARK NOTICES
Logical Operations and the Logical Operations logo are trademarks of Logical Operations, Inc. and its affiliates.
® ®
Microsoft Access is a registered trademark of the Microsoft Corporation in the U.S. and other countries. The other Microsoft
products and services discussed or described may be trademarks or registered trademarks of the Microsoft Corporation. All other
product and service names used may be common law or registered trademarks of their respective proprietors.
Copyright © 2013 Logical Operations, Inc. All rights reserved. Screenshots used for illustrative purposes are the property of the
software proprietor. This publication, or any part thereof, may not be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, storage in an information retrieval system, or otherwise, without
express written permission of Logical Operations, 3535 Winton Place, Rochester, NY 14623, 1-800-456-4677 in the United States
and Canada, 1-585-350-7000 in all other countries. Logical Operations’ World Wide Web site is located at
www.logicaloperations.com.
This book conveys no rights in the software or other products about which it was written; all use or licensing of such software or
other products is the responsibility of the user according to terms and conditions of the owner. Do not make illegal copies of books
or software. If you believe that this book, related materials, or any other Logical Operations materials are being reproduced or
transmitted without permission, please call 1-800-456-4677 in the United States and Canada, 1-585-350-7000 in all other countries.
Microsoft® Office
Access® 2013: Part 2

Designing a Relational Database.................................................... 1


Relational Database Design............................................................ 2
Create a Table.............................................................................. 10
Create Table Relationships........................................................... 20

Joining Tables..............................................................................27
Create Query Joins........................................................................28
Join Tables That Have No Common Fields.....................................34
Relate Data within a Table............................................................ 36
Work with Subdatasheets............................................................. 39
Create Subqueries........................................................................ 42

Organizing a Database for Efficiency........................................... 47


Data Normalization...................................................................... 48
Create a Junction Table................................................................ 53
Improve Table Structure............................................................... 56

Sharing Data Across Applications................................................ 61


Import Data into Access............................................................... 62
Export Data to Text File Formats.................................................. 67
Export Access Data to Excel......................................................... 70
Create a Mail Merge..................................................................... 73

Advanced Reporting.................................................................... 79
| Microsoft® Office Access® 2013: Part 2 |

Organize Report Information.................................................................. 80


Format Reports...................................................................................... 88
Include Control Formatting in a Report................................................... 94
Add a Calculated Field to a Report.......................................................... 97
Add a Subreport to an Existing Report.................................................. 100

Appendix A: Additional Reporting Options..........................................107


Create a Mailing Label Report............................................................... 108
Publish a Report as a PDF..................................................................... 111

Appendix B: Microsoft Office Access 2013 Exam 77-424....................113

Appendix C: Microsoft Access 2013 Common Keyboard Shortcuts...... 119

Lesson Labs........................................................................................ 121

Solutions............................................................................................ 125

Glossary............................................................................................. 127
Index.................................................................................................. 131
About This Course

Your training and experience using Microsoft® Access® 2013 has given you basic database
management skills such as creating tables, designing forms and reports, and building queries.
In this course, you will expand your knowledge of relational database design, write advanced
queries, structure existing data, share data across applications, and customize reports.
Extending your knowledge of Microsoft Access 2013 will result in a robust, functional
database for your users.
You can also use this course to prepare for the Microsoft Office Specialist (MOS)
Certification exams for Microsoft Access 2013.

Course Description
Target Student
This course is designed for students wishing to gain intermediate-level skills or individuals
whose job responsibilities include constructing relational databases, performing database
maintenance, creating advanced queries and reports, or integrating Access with other
programs.

Course Prerequisites
To ensure your success, it is recommended you have completed Microsoft® Office Access®
2013: Part 1, or possess equivalent knowledge.

Course Objectives
In this course, you will work with relational database structure, relationships, efficiency,
integrity, and customization.
You will:
• Design a relational database.
• Join tables to retrieve data from unrelated tables.
• Organize a database for efficiency and performance, and to maintain data integrity.
• Share data among Access and other applications.
• Customize reports to organize the displayed information and produce specific print
layouts.

The LogicalCHOICE Home Screen


The LogicalCHOICE Home screen is your entry point to the LogicalCHOICE learning
experience, of which this course manual is only one part. Visit the LogicalCHOICE Course
screen both during and after class to make use of the world of support and instructional
resources that make up the LogicalCHOICE experience.

http://www.lo-choice.com
| Microsoft® Office Access® 2013: Part 2 |

Log-on and access information for your LogicalCHOICE environment will be provided with your
class experience. On the LogicalCHOICE Home screen, you can access the LogicalCHOICE
Course screens for your specific courses.
Each LogicalCHOICE Course screen will give you access to the following resources:
• eBook: an interactive electronic version of the printed book for your course.
• LearnTOs: brief animated components that enhance and extend the classroom learning
experience.
Depending on the nature of your course and the choices of your learning provider, the
LogicalCHOICE Course screen may also include access to elements such as:
• The interactive eBook.
• Social media resources that enable you to collaborate with others in the learning community
using professional communications sites such as LinkedIn or microblogging tools such as
Twitter.
• Checklists with useful post-class reference information.
• Any course files you will download.
• The course assessment.
• Notices from the LogicalCHOICE administrator.
• Virtual labs, for remote access to the technical environment for your course.
• Your personal whiteboard for sketches and notes.
• Newsletters and other communications from your learning provider.
• Mentoring services.
• A link to the website of your training provider.
• The LogicalCHOICE store.
Visit your LogicalCHOICE Home screen often to connect, communicate, and extend your learning
experience!

How to Use This Book


As You Learn
This book is divided into lessons and topics, covering a subject or a set of related subjects. In most
cases, lessons are arranged in order of increasing proficiency.
The results-oriented topics include relevant and supporting information you need to master the
content. Each topic has various types of activities designed to enable you to practice the guidelines
and procedures as well as to solidify your understanding of the informational material presented in
the course. Procedures and guidelines are presented in a concise fashion along with activities and
discussions. Information is provided for reference and reflection in such a way as to facilitate
understanding and practice.
Data files for various activities as well as other supporting files for the course are available by
download from the LogicalCHOICE Course screen. In addition to sample data for the course
exercises, the course files may contain media components to enhance your learning and additional
reference materials for use both during and after the course.
At the back of the book, you will find a glossary of the definitions of the terms and concepts used
throughout the course. You will also find an index to assist in locating information within the
instructional components of the book.

As You Review
Any method of instruction is only as effective as the time and effort you, the student, are willing to
invest in it. In addition, some of the information that you learn in class may not be important to you
immediately, but it may become important later. For this reason, we encourage you to spend some
time reviewing the content of the course after your time in the classroom.

| About This Course |


| Microsoft® Office Access® 2013: Part 2 |

As a Reference
The organization and layout of this book make it an easy-to-use resource for future reference.
Taking advantage of the glossary, index, and table of contents, you can use this book as a first
source of definitions, background information, and summaries.

Course Icons
Watch throughout the material for these visual cues:

Icon Description

A Note provides additional information, guidance, or hints about a topic or task.

A Caution helps make you aware of places where you need to be particularly careful
with your actions, settings, or decisions so that you can be sure to get the desired
results of an activity or task.
LearnTO notes show you where an associated LearnTO is particularly relevant to
the content. Access LearnTOs from your LogicalCHOICE Course screen.
Checklists provide job aids you can use after class as a reference to performing
skills back on the job. Access checklists from your LogicalCHOICE Course screen.
Social notes remind you to check your LogicalCHOICE Course screen for
opportunities to interact with the LogicalCHOICE community using social media.
Notes Pages are intentionally left blank for you to write on.

| About This Course |


1 Designing a Relational
Database
Lesson Time: 1 hour, 10 minutes

Lesson Objectives
In this lesson, you will design a relational database. You will:
• Explain the relational database design process.
• Create a table.
• Create table relationships.

Lesson Introduction
A properly designed database provides you with accurate, up-to-date information. In
Microsoft Access, you must create the structure of the database before you can begin
entering data. Employing correct design will ensure that you end up with a database that
meets your needs. In this lesson, you will decide what information you need, how to divide
that information into appropriate tables and fields, and how to relate the tables to each
other.
2 | Microsoft® Office Access® 2013: Part 2

TOPIC A
Relational Database Design
Database design is not an exact science. It is important to take time to understand the principles of
good design so that you end up with an effective, accurate, and efficient database. In this topic, you
will explain the process of creating a relational database. This process will lay a foundation for you
to design great databases the first time, every time.

Relational Databases
Database Relationship A relational database organizes data into related tables stored in the same file. You relate the tables by
linking common fields. For example, if you have two tables named Customer and Invoice, the tables
can be linked by using the common field CustomerID. You can then easily display information from
each table in a single query or report.

Figure 1-1: Database relationship between two tables.

An Excel® spreadsheet is a simple database with single tables. It is considered a flat database
because it does not link to any other data. Microsoft Office Access 2013 is a relational database
management system.

The Relational Database Design Process


Relational Database It is important to take time "offline" to design a database that accurately and effectively meets your
Design Process needs. The following list is a framework for the process.
To design a relational database, determine its characteristics:
1. The purpose of the database
2. The queries, forms, and reports to generate
3. The fields needed
4. The tables needed
5. The keys and relationships

Lesson 1: Designing a Relational Database | Topic A


Microsoft® Office Access® 2013: Part 2 | 3

The next few sections will examine these principles in more detail.

The Statement of Purpose


The statement of purpose is a written statement defining the objectives of the database, such as, "This Statement of Purpose
database will be used to organize data related to customers, products, and sales."
Answers to the following questions will help guide the design process:
• Who will use the database? Encourage the students
to share their answers or
• What questions will they want answered? do this as a group
• What forms or reports will they want generated? discussion. Some
Now you can plan and create a database that will store the needed data to provide the required students will have
answers that others
information.
might not have
considered.
Existing Data
Existing data is information an organization already gathers. After talking with the database users, Existing Data
determine what data they currently collect that is relevant to your objectives. Look at existing paper
and electronic documents such as statements and invoices. Sketch out what the queries, forms, and
reports should look like. A well-designed database requires up-front planning. You don't want
missing or redundant data.

Guidelines for Determining Fields


Remember, a field is a column in a table containing a single piece of information. It is the equivalent Guidelines for
of a cell in a spreadsheet. A field might contain a name, an address, or a telephone number. Determining Fields
To determine the fields you need for your database:
• List all the fields needed to produce the required information you sketched out when you
analyzed existing data.
• Break each piece of data into small, usable parts. For instance, you could store a customer's full
name in one field called CustomerName, but then would not be able to alphabetize by last name.
Creating separate fields called FirstName and LastName would make it easier to work with the
data.
• You should also determine which fields contain stored data and which fields are calculated at
runtime. An example of stored data is the price of an item. If a customer purchases several
products, a calculated field named Subtotal could add all the purchase prices together.

Lesson 1: Designing a Relational Database | Topic A


4 | Microsoft® Office Access® 2013: Part 2

Fields for Customer,


Product, and Sales
Information

Figure 1-2: Fields needed to provide customer, product, and sales information.

Business Rules
Business Rules Business rules are policies and procedures that dictate how a business does business, such as, "A
Ask for examples of customer with a VIP status receives a 10-percent discount." These rules influence database design by
different business rules applying limitations and constraints or processes to the data collected and stored, the relationships
the learners have in their defined and established, and the types of information provided. This helps enforce and maintain
companies. data integrity. Consider this business rule: “We ship our products only in the continental United
States.” That particular rule imposes a restriction by not allowing entry in the database of a state
outside the lower 48 states. An example of a constraint that can be placed on the relationships
between tables is, "A supplier must supply a minimum of one product." A single record in the
Suppliers table must be related to at least one record in the Products table.

Guidelines for Grouping Fields into Tables


Guidelines for Grouping Remember, a table organizes data in columns and rows, similar to a spreadsheet. Each row in a table
Fields into Tables is a record consisting of data pertaining to one entity. All data in an Access database is stored in one
or more tables.
To group fields into tables:
• Distribute fields into tables according to subject.
• Avoid storing or updating the same field in two places. For example, if you have customer
contact information in only one table, you can quickly update an address without having to
remember all the other places where contact information is stored. This conserves space and
reduces errors.
• Identify the common, or key, fields to be used to link tables together.
The design process of simplifying table structure is called normalization. The following figure shows
how you might arrange fields into three tables dealing with customers, invoices, and products. In
this example, a common field could be CustomerID, InvoiceNo, or ProductCode.

Lesson 1: Designing a Relational Database | Topic A


Microsoft® Office Access® 2013: Part 2 | 5

Fields Grouped into


Tables

Figure 1-3: Fields grouped into tables.

Primary Keys
A primary key uniquely identifies each record in a table. A Social Security number, employee ID, or Primary Keys
ISBN work well as primary keys. A phone number would be a poor choice for a primary key, as
more than one person in a household could be using the same phone number, the phone number
could change, or someone might not have a phone number. You do not want duplicate values in
your primary key. You do not want a primary key that changes, as other tables may reference the
primary key. You do not want a primary key that is empty or null. Access does not require a primary
key, but it is a good idea to include one. Access automatically creates an index for the primary key,
which facilitates data search and retrieval. If you don't have something that naturally serves as the
primary key, you can add a field by using the AutoNumber data type.

Foreign Keys
A foreign key is another table's primary key. For example, the CustomerID field in the Customers Primary and Foreign
table also appears in the Invoices table. In the Customers table, it is the primary key, and in the Keys
Invoices table, it is the foreign key. A foreign key actually does not need to have the same name as
the primary key, but it does need to have the same structure, data type, and field size.

Lesson 1: Designing a Relational Database | Topic A


6 | Microsoft® Office Access® 2013: Part 2

Figure 1-4: Two tables with primary and foreign key fields.

Composite Keys
Composite Keys A composite key is the result of two or more fields functioning as the primary key. For example, an
Order Details table will have repeated values. There is not one field that could uniquely identify a
record. In this situation, you could use two columns for the primary key: OrderID and ProductID.

Figure 1-5: A table with a composite key.

Lesson 1: Designing a Relational Database | Topic A


Microsoft® Office Access® 2013: Part 2 | 7

Table Relationships
Relationship is an association between common fields in two tables. You use table relationships to
bring information together in meaningful ways. There are three relationship types:
• One-to-one
• One-to-many
• Many-to-many
The first two types will
One-to-One Relationships be discussed in this
lesson, and the third one
Two tables have a one-to-one relationship if for every record (row) in the first table, there is a matching will be discussed in
record (row) in the second table. This type of relationship does not exist in the real world, and has Lesson 3, Topic B,
specific uses in Access: “Many-to-Many
• Getting around the Access limitation of 255 columns Relationships.”
• Optimizing database performance One-to-One
Relationships
• Separating sensitive data
• Storing supplemental information
For example, you may have a Products table where some items have optional data, such as an image
or a comment. Storing this information may result in empty space for the records without it.
Instead, you create another table, enter records for only those products that have supplemental data,
and join them on the column that is the same.

Figure 1-6: A one-to-one relationship between two tables.

One-to-Many
One-to-Many Relationships Relationships
Two tables have a one-to-many relationship if for every record (row) in the first table, there can be zero,
one, or many records (rows) in the second table; but for every record (row) in the second table,
there is exactly one record (row) in the first table. The one-to-many relationship is the most
common relationship type and is also referred to as a parent-child relationship.
For example, you have Suppliers and Products tables. A supplier can supply numerous products.
For any one supplier listed in the Suppliers table, there can be many products listed in the Products
table. Join the primary key of the one side (source table) to the foreign key of the many side (target
table).

Lesson 1: Designing a Relational Database | Topic A


8 | Microsoft® Office Access® 2013: Part 2

Figure 1-7: A one-to-many relationship between two tables.

Lesson 1: Designing a Relational Database | Topic A


Microsoft® Office Access® 2013: Part 2 | 9

ACTIVITY 1-1
Analyzing the Relational Database Design
Process

Scenario
In this activity, you will examine the process of designing a relational database.
If you have learners
connecting to the
1. Which statement about relational databases is false? classroom from a remote
○  Fields are columns of data. location, be sure to pose
questions in a way that
○  Information is stored in a single table. enables them to
○  Redundant data wastes space. participate. For example,
you might pose the
○  Rows contain items related to one entity. question to them first,
through your chat/
2. True or false? Paper forms are an example of existing data. messaging system, then
○  True have in-class learners
add their thoughts to the
○  False discussion. You might
write notes in a shared
3. True or false? It does not matter whether or not you break data into its smallest logical parts. application window or on
○  True a whiteboard as
students share their
○  False responses.

4. Which is the term for the field in a table that contains unique information for each record?
○  Foreign key
○  Composite key
○  Primary key
5. True or false? A real-world example of a one-to-many relationship would be a manager overseeing zero
or more employees, while an employee has one manager.
○  True
○  False

Lesson 1: Designing a Relational Database | Topic A


10 | Microsoft® Office Access® 2013: Part 2

TOPIC B
Create a Table
To store data in a database, you need to create tables. In this topic, you will create a table. Tables are
the foundation of your database, so you'll need to establish a strong base.

Table Views
Table Views Access provides two views for working with tables: Datasheet and Design.
• Datasheet view displays fields in columns and records in rows similar to a table or spreadsheet.
This is the default view.
• Design view displays the underlying structure of the table's fields, but does not display the data
stored in the table.
You can insert fields in either Datasheet or Design view. Be aware that there are a few different
data types available in the different views.

Switch Table Views


Access provides several ways to switch between views of an open table:

• On the right side of the status bar, use the View buttons.
• On the ribbon, use the View button.

• In the Navigation pane, right-click the table name and select an available view. Not all views are
available for all objects.
• In the Documents pane, right-click a tab and select a view.

Data Types
Data type is the field property that determines what data value you can store. The next two figures
show the data types available in Datasheet view and in Design view.

List of Data Types in


Datasheet View

Lesson 1: Designing a Relational Database | Topic B


Microsoft® Office Access® 2013: Part 2 | 11

Figure 1-8: List of data types in Datasheet view.

List of Data Types in


Design View

Figure 1-9: List of data types in Design view.

The following table describes some of the different data types.


Data Types
Data Type Use to Display

Short Text Alphanumeric values such as a name, address, or phone number


Number Numeric values used in calculations
Currency Monetary values, such as $100.00
Date & Time Dates and times, such as 6/30/2014 10:00:00 AM

Lesson 1: Designing a Relational Database | Topic B


12 | Microsoft® Office Access® 2013: Part 2

Data Type Use to Display


Yes/No Yes and No values
Lookup & Lists in other tables, or a list of user-defined values
Relationship
Rich Text Alphanumeric values that can be formatted by using color and font
controls
Long Text Long blocks of text, such as comments or notes
Attachment Images, spreadsheets, documents, and other types of files
Hyperlink Web addresses or links to files
Calculated Field Results of a calculation

Note: For details about defining field characteristics, see the LearnTO Set Field Properties
presentation from the LearnTO tile on your LogicalCHOICE Course screen.

You may want to show


LearnTO Set Field
Properties from the Access the Checklist tile on your LogicalCHOICE course screen for reference
LogicalCHOICE Course information and job aids on How to Insert Fields
screen or have students
navigate out to the
Course screen and
watch it themselves as a Calendar for Picking Dates
supplement to your
The built-in date picker displays a small calendar icon on the right side of any Date/Time field.
instruction. If not, please
remind students to visit
Select the icon to pick a date.
the LearnTOs for this
course on their
LogicalCHOICE Course
screen after class for
supplemental
information and
additional resources.
Calendar for Picking
Dates

Figure 1-10: Calendar expanded to select a value for a date field.

You can turn this feature off in Design view in the Field Properties section by setting the Show
Date Picker property to Never.

Lesson 1: Designing a Relational Database | Topic B


Microsoft® Office Access® 2013: Part 2 | 13

Turn the Date Picker On


or Off

Figure 1-11: Turn the date picker on or off.

Note: You can specify an Input Mask for the date, or any field, to control how it will look. If
you use an input mask for a Date/Time field, the Date Picker control is unavailable.

Note: For details on helping users to input data in the correct format, see the LearnTO Create
Input Masks presentation from the LearnTO tile on your LogicalCHOICE Course screen.

You may want to show


LearnTO Create Input
The Lookup Wizard Masks from the
LogicalCHOICE Course
The Lookup Wizard is used to create lookup fields. There are two types of lookup fields you can screen or have students
create: a lookup list and a value list. A lookup list retrieves values from another table or query, thus navigate out to the
making data entry quicker and more accurate. A value list gets its data from a list of values you Course screen and
specify. This is useful to restrict the data that can be entered into the field. Lookup fields can store watch it themselves as a
single or multiple values. supplement to your
instruction. If not, please
remind students to visit
the LearnTOs for this
course on their
LogicalCHOICE Course
screen after class for
supplemental
information and
additional resources.
Lookup Wizard

Lesson 1: Designing a Relational Database | Topic B


14 | Microsoft® Office Access® 2013: Part 2

Figure 1-12: The Lookup Wizard options for creating lookup fields.

Access the Checklist tile on your LogicalCHOICE course screen for reference
information and job aids on How to Insert Lookup Fields

The Table Properties Dialog Box


The Table Properties To view or modify an existing table's properties, use the Table Properties dialog box:
Dialog Box • Enter a description about the table.
• View the date and time the table was created and last modified.
• View the owner of the table.
• Hide or unhide the table.

Lesson 1: Designing a Relational Database | Topic B


Microsoft® Office Access® 2013: Part 2 | 15

Figure 1-13: Options available in the Table Properties dialog box.

Access the Checklist tile on your LogicalCHOICE course screen for reference
information and job aids on How to Create or Modify a Table

Lesson 1: Designing a Relational Database | Topic B


16 | Microsoft® Office Access® 2013: Part 2

ACTIVITY 1-2
Creating a Table

Data Files
C:\091005Data\Designing a Relational Database\CheeseEmporium_1.accdb

Scenario
Creating databases is part of your job at the That's Cheezie Cheese Emporium, a specialty food
vendor with both retail and web sales. You decide to create a table to store employee data.

1. Create a table.
a) Open the CheeseEmporium_1 database.
b) If necessary, on the Message Bar, select Enable Content.
Students are saving a c) Save the database to C:\091005Data\Designing a Relational Database as My CheeseEmporium_1
copy of the database so d) If necessary, on the Message Bar, select Enable Content.
that the original remains e) Select CREATE→Tables→Table.
unchanged in case they
want to re-key the Note: This course uses a streamlined notation for ribbon commands. They'll
course in the future. appear as "[Ribbon Tab]→[Group]→[Button or Control]" as in "select
Home→Clipboard→Paste." If the group name isn't needed for navigation or
there isn't a group, it's omitted, as in "select File→Open."
f) On the Quick Access Toolbar, select Save.
g) In the Save As dialog box, in the Table Name text box, type tblEmployees and select OK.

2. Add fields in Datasheet view.


a) In the first column, select ID and rename it EmployeeID
b) In the second column, select Click to Add, and select Short Text. Name the column Last Name
c) In the third column, select Click to Add, and select Short Text. Name the column First Name

Let students know that


they will change the data 3. Add fields in Design view.
types of the added fields a) On the right side of the status bar, select the Design View button.
in the next steps. b) In the tblEmployees table, in the Field Name column, in the fourth row, type HireDate and press
Enter.

Lesson 1: Designing a Relational Database | Topic B


Microsoft® Office Access® 2013: Part 2 | 17

c) In the fifth row, type Status and press Enter.

4. Set the data types.


a) In the Data Type column, observe that the data type for the EmployeeID field is set to AutoNumber,
and Last Name and First Name are set to Short Text.
b) For the HireDate field, select the Data Type column, and from the drop-down list, select Date/Time.

5. Create a value list for the Status field.


a) For the Status field, select the Data Type column, and from the drop-down list, select Lookup
Wizard.
b) If a Microsoft Access Security Notice dialog box appears, select Open to start the wizard.
c) In the Lookup Wizard, select I will type in the values that I want and select Next.
d) In the Col1 column, in the first cell, type Exempt and press Tab.
e) In the second cell, type Non-exempt and select Next.

f) In the Do you want to limit entries to the choices? section, check the Limit To List check box and
select Finish.

Lesson 1: Designing a Relational Database | Topic B


18 | Microsoft® Office Access® 2013: Part 2

6. Add a record to the table.


a) On the right side of the status bar, select the Datasheet View button.
b) In the Microsoft Access dialog box, select Yes to save the table.
c) In the Last Name column, in the first cell, type Peters and press Tab.
d) In the First Name column, type Jasmine and press Tab.
e) Select the HireDate column, select the calendar icon, navigate to January 2012, and select 18.
f) Select the Status column, and from the drop-down list, select Non-exempt.

g) On the Quick Access Toolbar, select Save.


h) Close the table.

7. Add a description to the table.


a) In the Navigation pane, right-click tblEmployees and select Table Properties.
b) In the Description text box, type Employee Details and then select OK.

Lesson 1: Designing a Relational Database | Topic B


Microsoft® Office Access® 2013: Part 2 | 19

Lesson 1: Designing a Relational Database | Topic B


20 | Microsoft® Office Access® 2013: Part 2

TOPIC C
Create Table Relationships
After you have tables for each subject in your database, define table relationships to connect the
data in the tables. Then you can use a query, form, or report to extract data from them as though
they were one large table. In this topic, you will create relationships between tables in an Access
database. By setting table relationships correctly from the start, it will ensure that data stays
synchronized across all related tables.

The Relationships Window


Relationships Window The Relationships window graphically displays the tables in a database, the fields in each table, and the
relationships between those tables. You can define new relationships, change existing relationships,
or rearrange the layout of the tables in this window.

Figure 1-14: The Relationships window displaying the relationship between two tables.

Open the Relationships Window


To open the Relationships window, select DATABASE
TOOLS→Relationships→Relationships.

Referential Integrity
Referential integrity is a set of rules Access uses to preserve the defined relationships between tables
when data is updated. Specifically, each foreign key value must match a primary key value in linked
tables.
For example, you would not want to change an order number in the Orders table if there are line
items assigned to that order in the Order Details table. Additionally, you would not want to delete
an employee record from the Employees table if there are orders assigned to that employee in the
Orders table.

Lesson 1: Designing a Relational Database | Topic C


Microsoft® Office Access® 2013: Part 2 | 21

Guidelines for Enforcing Referential Integrity


To prevent inconsistent data or orphaned records, follow these guidelines to ensure referential Guidelines for Enforcing
integrity: Referential Integrity
• When adding a record to a table with a foreign key, make sure a matching record already exists in
the primary key table.
• When changing the value of a foreign key, make sure the value exists in the primary key table.
• When deleting a record in the primary key table, make sure no matching records exist in a related
table.
Fortunately, Access can be set to perform the checks for you and enforce referential integrity.

The Edit Relationships Dialog Box


The Edit Relationships dialog box allows you to change a table relationship. The dialog box shows the Edit Relationships
primary table, related table, common field, and relationship type. Dialog Box

Figure 1-15: The Edit Relationships dialog box displaying options to modify an existing table
relationship.

You can set options in the Edit Relationships dialog box to enforce referential integrity.
Enforce Referential
Note: When you choose to enforce referential integrity with data already stored in tables, Access Integrity Options
will check the data to validate that the rules are enforceable. If not, you will be prompted to take Tell students they should
corrective action and try again. rarely check the
Cascade Delete Related
Option Description Records check box
because it might result in
Enforce Referential Access will not allow you to enter a value in the foreign key field of a deleting records they
Integrity related table if that value doesn't exist in the primary key field of the didn't intend to delete.
primary table.
Cascade Update Access will update the appropriate foreign key values in the related
Related Fields table when you change a primary key value in the primary key table.
Cascade Delete Access will delete the record in the primary table and also delete all
Related Records records in related tables that have matching foreign key values.

Lesson 1: Designing a Relational Database | Topic C


22 | Microsoft® Office Access® 2013: Part 2

Join Lines
Join Line A join line connects the common field used to create the relationship between two tables. If you
checked the Enforce Referential Integrity check box, the line appears thicker at each end and
displays either the number 1 or an infinity symbol (∞) to indicate the relationship between the
tables.

Figure 1-16: A join line indicating that referential integrity will be enforced.

You can edit a relationship by double-clicking the join line, which will appear thicker when selected,
and then making changes in the Edit Relationships dialog box. To remove a relationship, select
the join line and press Delete.

Relationship Report
Relationship Report A relationship report is a display of the map of how your database tables are related, as shown in the
Relationships window. You can view the report in a preview window, save it, or print a hard copy.

Figure 1-17: The relationship report in the preview window.

View Relationship Report


To view the relationship report, with the Relationships window open, select
DESIGN→Tools→Relationship Report.

Access the Checklist tile on your LogicalCHOICE course screen for reference
information and job aids on How to Create a Table Relationship

Lesson 1: Designing a Relational Database | Topic C


Microsoft® Office Access® 2013: Part 2 | 23

ACTIVITY 1-3
Creating a Table Relationship

Before You Begin


The My CheeseEmporium_1 database is open.

Scenario
Data is stored in a Categories table and Products table in your database. You want to relate these
two tables so you can retrieve information across them. Additionally, you want to print the
relationship report.

1. Display the required tables in the Relationships window.


a) Select DATABASE TOOLS→Relationships→Relationships.
The Show Table dialog box automatically appears.

Note: If the Show Table dialog box does not appear, select
DESIGN→Relationships→Show Table.
b) On the TABLES tab, verify that tblCategories is selected.
c) While pressing Ctrl, select tblProducts.

d) Select Add to add the selected tables to the Relationships window, and then select Close.

2. Create a table relationship.


a) In the Relationships window, in the tblCategories field list, drag the CategoryNo field to the
tblProducts field list’s CategoryNo field.
b) In the Edit Relationships dialog box, select Create.
c) In the Relationships window, observe that a join line connecting the CategoryNo fields in the two
tables is displayed.

Lesson 1: Designing a Relational Database | Topic C


24 | Microsoft® Office Access® 2013: Part 2

3. Edit the relationship.


a) Double-click the join line to select it.
b) In the Edit Relationships dialog box, check the Enforce Referential Integrity check box to enforce
referential integrity in the relationship.

c) Select OK.
d) Observe that the join line now shows the number 1 and an infinity symbol (∞) on each end.
e) On the Quick Access Toolbar, select Save to save the relationship defined between the tables.

4. Print a relationship report.


a) Select DESIGN→Tools→Relationship Report.
b) If a Microsoft Access Security Notice dialog box appears, select Open to show the report.
c) Observe that the table relationship is displayed as a map, and on the ribbon, the PRINT PREVIEW
tab is displayed.
d) Select FILE→Save As.
e) On the Save As screen, under File Types, select Save Object As, and then select Save As.
f) In the Save As dialog box, in the Save 'Report1' to text box, type rptCategoryProducts and select
OK.
g) Select PRINT PREVIEW→Print→Print.
If there are printers h) In the Print dialog box, select OK to print the relationship report, or select Cancel if no printer is
available, you can have available.
students print their i) Select PRINT PREVIEW→Close Preview→Close Print Preview.
reports. j) Close all open tabs.

5. Select FILE→Close.

Lesson 1: Designing a Relational Database | Topic C


Microsoft® Office Access® 2013: Part 2 | 25

Summary
In this lesson, you discovered how to plan, design, and create relational databases from scratch. You
built the structure of a table and related tables to each other, resulting in a well-made database.
What do you think are the most important guidelines to follow when designing a relational database?
A: Answers will vary, but may include identifying the fields needed to produce the required information
and breaking them into their smallest usable parts, grouping related fields into tables to reduce
redundant data, and determining primary and foreign keys so you can link tables.

What tables and fields might you include often when creating databases?
A: Answers will vary, but may include a table to store customer details and another table to track orders.
Fields may include customer ID, first name, last name, address, phone number, order number, and
order total.

Note: Check your LogicalCHOICE Course screen for opportunities to interact with your
classmates, peers, and the larger LogicalCHOICE online community about the topics covered in
this course or other topics you are interested in. From the Course screen you can also access
available resources for a more continuous learning experience.

Encourage students to
use the social
networking tools
provided on the
LogicalCHOICE Home
screen to follow up with
their peers after the
course is completed for
further discussion and
resources to support
continued learning.

Lesson 1: Designing a Relational Database |


2 Joining Tables
Lesson Time: 1 hour, 10 minutes

Lesson Objectives
In this lesson, you will join tables. You will:
• Create query joins to retrieve data.
• Join two tables with no common field.
• Relate data within a table.
• View data from related tables.
• Create subqueries.

Lesson Introduction
Sometimes you want to retrieve data from unrelated tables and control what records are
displayed. Microsoft Access allows you to retrieve information spread across tables. In this
lesson, you will extract data you want from single or multiple tables, including those with no
common fields.
28 | Microsoft® Office Access® 2013: Part 2

TOPIC A
Create Query Joins
You know how to create a table relationship in the Relationships window. In this topic, you will see
how to create several different types of temporary relationships. The ability to join two or more
tables and extract the data from them is one of the most powerful features of any relational
database.

Query Joins
Query Joins A query join is similar to a relationship, but it is temporary. You can join queries in the same way that
you join tables. A query join can even temporarily override a permanent relationship. Access
automatically creates a join if there is already a relationship between two tables that you use in a
query. A join is also created if there are fields that clearly correspond to each other. You can delete
an automatically created join. You can also manually create joins in queries, even if they do not
represent relationships that have already been defined. There are various types of joins, and by
knowing how to use them, you can control which records will be displayed as the output, enabling
you to find the exact data you are looking for.

Figure 2-1: A join created in the query Design window.

Inner Joins
Inner Join An inner join shows only the records that have matching values in the joined field in both tables.
Records with values in the joined field that do not appear in both tables will be excluded from the
query. Inner joins are the most common type of join, and Access creates them automatically.

Lesson 2: Joining Tables | Topic A


Microsoft® Office Access® 2013: Part 2 | 29

Figure 2-2: A Venn diagram showing an inner join.

Outer Joins
An outer join shows all the records from one table and only those records from the other table that Left Outer Join
have matching values from the first table. This may leave some of the fields blank. Practical uses for
an outer join would be to find out which companies have no contacts, or which products haven't
been sold. There are two possible outer joins: the left outer join and the right outer join.
A left outer join will return all records from the primary table and only matching records from the
foreign table.

Figure 2-3: A Venn diagram showing a left outer join.

Lesson 2: Joining Tables | Topic A


30 | Microsoft® Office Access® 2013: Part 2

A right outer join returns all records from the foreign table and only matching records from the
primary table.
Right Outer Join

Figure 2-4: A Venn diagram showing a right outer join.

Note: A good way to remember the difference between a left or right join is to determine which
table is "leading" the query—the one on the left or the one on the right.

Note: A Cartesian join (also called Cross join), which usually happens by mistake when no join
is defined between a pair of tables, combines each row from one table with each row from
another table. This can yield a large number of records. Consider two tables of 100 records each.
Multiply the number of records in the first table by the number of records in the second table.
This join would create a table of 10,000 (100 × 100) records and probably take a long time to
run.

The Join Properties Dialog Box


Join Properties Dialog The Join Properties dialog box lets you specify how two tables are to be joined. There are three choices:
Box • Option 1 is the inner join (the default).
• Option 2 is the left outer join.
• Option 3 is the right outer join.

Lesson 2: Joining Tables | Topic A


Microsoft® Office Access® 2013: Part 2 | 31

Figure 2-5: The Join Properties dialog box displaying join options.

The Join Properties dialog box displays the left and right table names, which determine which table
in an outer join is going to return all rows. The following table helps clarify the outcomes for each
of the choices in the Join Properties dialog box.
What the Join Options
Option Join Type Left Table Right Table Return

1. Only include rows where the Inner Matching rows Matching rows
joined fields from both tables are
equal.
2. Include ALL records from Left outer All rows Matching rows
'tblCustomers' and only those
records from 'tblOrders' where the
joined fields are equal.
3. Include ALL records from Right outer Matching rows All rows
'tblOrders' and only those records
from 'tblCustomers' where the
joined fields are equal.

Access the Checklist tile on your LogicalCHOICE course screen for reference
information and job aids on How to Create Query Joins

Lesson 2: Joining Tables | Topic A


32 | Microsoft® Office Access® 2013: Part 2

ACTIVITY 2-1
Creating Inner and Outer Joins

Data Files
C:\091005Data\Joining Tables\CheeseEmporium_2.accdb

Scenario
The CheeseEmporium database has a query based on the Customers and Orders tables. You want
to display customer information showing who has placed orders as well as who has not.

1. Open and save the database.


a) Open the CheeseEmporium_2 database.
b) If necessary, on the Message Bar, select Enable Content.
c) Save the database as My CheeseEmporium_2
d) If necessary, on the Message Bar, select Enable Content again.

2. Run an existing query.


a) Open the qryJoins query in Design view.
b) In the tblCustomers field list, drag the CustomerID field to the tblOrders field list's CustomerID field.
This is an inner join by default.

Note: If Access automatically created a join between the CustomerID fields,


then you do not need to perform the join.
c) Select DESIGN→Results→Run.
d) Observe that there are 14 records. Only those records from the tblCustomers and tblOrders tables
that have matching values are combined.
e) Select FILE→Save As.
f) On the Save As screen, select Save Object As, and then select Save As.
g) In the Save As dialog box, in the Save 'qryJoins' to text box, type qryJoinsInner and select OK.

3. Change the join type to a left outer join.


a) Switch to Design view.
b) Double-click the join line that connects the tblCustomers and tblOrders field lists.

c) In the Join Properties dialog box, select option 2: Include ALL records from 'tblCustomers' and only
those records from 'tblOrders' where the joined fields are equal, and select OK.
d) Observe the arrow on the join line pointing to the side of the relationship that shows matching rows.
e) Run the query.

Lesson 2: Joining Tables | Topic A


Microsoft® Office Access® 2013: Part 2 | 33

f) Observe that this includes all customers (20 records), even those who have not yet placed any
orders (indicated by the blanks in the OrderDate column).
g) Save the query as qryJoinsLeft

4. Change the join type to a right outer join.


a) Switch to Design view.
b) Edit the join line and select option 3: Include ALL records from 'tblOrders' and only those records
from 'tblCustomers' where the joined fields are equal, and select OK.
c) Run the query.
d) Observe that there are 15 records, and the first row has a date in the OrderDate column but no
CustomerID. That is because referential integrity was not enforced and there is an orphaned order
(an order with no customer).
e) Save the query as qryJoinsRight
f) Close the query.

Lesson 2: Joining Tables | Topic A


34 | Microsoft® Office Access® 2013: Part 2

TOPIC B
Join Tables That Have No Common Fields
You know how to join two tables with a common field. In this topic, you will join tables that have
no common fields. You do this by including a table in the middle that contains fields that are
common to both tables. This will enable you to retrieve data from tables that are indirectly related to
each other.
A Join

Figure 2-6: A join created between tblProducts and tblSuppliers using a third table.

Access the Checklist tile on your LogicalCHOICE course screen for reference
information and job aids on How to Join Tables That Have No Common Field

Lesson 2: Joining Tables | Topic B


Microsoft® Office Access® 2013: Part 2 | 35

ACTIVITY 2-2
Joining Unrelated Tables

Before You Begin


My CheeseEmporium_2.accdb is open.

Scenario
You have been asked to provide the supplier's contact information for the products in your
database. This information is in two unrelated tables that don't have any fields in common.

1. View an existing query and add the tblCategories table.


a) Open the qryUnrelatedJoin query in Design view.
b) Observe that the tblProducts and tblSuppliers tables do not share a common field.
c) Select DESIGN→Query Setup→Show Table.
d) In the Show Table dialog box, on the Tables tab, verify that tblCategories is selected, select Add,
and then select Close.

2. Drag the title bar of the tables as needed so that tblCategories is between tblProducts and tblSuppliers.

3. Create relationships, if needed.


a) Drag the CategoryNo field from tblProducts to tblCategories, if needed.
b) Drag the SupplierID field from tblCategories to tblSuppliers, if needed.

Note: Access may automatically create these two joins. If so, then verify that
they match the joins listed above and move on to the next step.

4. Add a field to the query design.


a) From the tblCategories field list, double-click CategoryNo to add it to the sixth cell in the Field row of
the grid.

5. Run the query.

6. Observe that the supplier's name and phone number appear for each product.

7. On the Quick Access Toolbar, select Save to save the query with the same name.

8. Close the query.

Lesson 2: Joining Tables | Topic B


36 | Microsoft® Office Access® 2013: Part 2

TOPIC C
Relate Data within a Table
You have worked with several join types. In some cases, however, the related data is all within a
single table. In this topic, you will use a special join type that can be used to retrieve the desired data
from within a table.

Self Joins
Self Join A self join is a join that relates data in a table to itself. For example, employees may have a field called
Supervisor containing the employee ID of the person who is their supervisor. To find out the
supervisor's name, the table must look itself up.

Figure 2-7: A self join using two copies of the same table.

The Alias Property


When adding the same table to the query design grid twice, it is good practice to change the name of
one of the tables. This can be done by assigning an alias to the second instance of the table. You are
not renaming the underlying table, only changing its name in Design view.

Access the Checklist tile on your LogicalCHOICE course screen for reference
information and job aids on How to Relate Data within a Table

Lesson 2: Joining Tables | Topic C


Microsoft® Office Access® 2013: Part 2 | 37

ACTIVITY 2-3
Creating a Self Join

Before You Begin


My CheeseEmporium_2.accdb is open.

Scenario
In the tblEmployees table, there is a column containing the employee ID of each employee's
supervisor. Supervisors are also employees and have records in the table. You would like to create a
list of employees along with the last name of their supervisor.

1. Add a second tblEmployees table to the query design grid.


a) Open the qrySelfJoin query in Design view.
b) Select DESIGN→Query Setup→Show Table.
c) In the Show Table dialog box, on the Tables tab, select tblEmployees, select Add, and then select
Close.

2. Assign an alias to the duplicate table and create a self join.


a) Right-click the tblEmployees_1 table and select Properties.
b) In the Property Sheet pane, in the cell to the right of Alias, replace the text with Supervisors and
press Enter.
c) Close the Property Sheet pane.
d) Observe that tblEmployees_1 is now renamed Supervisors.
e) From the tblEmployees field list, drag Supervisor to the EmployeeID field in the Supervisors field list.

3. Complete the query design by adding a field to the grid.


a) In the Supervisors table, double-click the LastName field to add it to the third cell of the Field row.

Lesson 2: Joining Tables | Topic C


38 | Microsoft® Office Access® 2013: Part 2

4. Run the query.

5. Observe that the third column displays the last name of each employee's supervisor.

6. Save the query with the same name.

7. Close the query.

Lesson 2: Joining Tables | Topic C


Microsoft® Office Access® 2013: Part 2 | 39

TOPIC D
Work with Subdatasheets
Sometimes you may need to view data in related tables simultaneously. In this topic, you will work
with subdatasheets. In addition to viewing related data from another table, you can also modify it.

Subdatasheets
A subdatasheet is a datasheet within another datasheet. After you create a relationship between two Subdatasheet
tables, Access automatically adds a subdatasheet. You can also manually insert another table as a
subdatasheet. A plus sign (+) is displayed next to every record of the table that is on the one side of
the relationship. Selecting the plus sign displays the subdatasheet and changes the plus sign to a
minus sign (–). Selecting the minus sign collapses the subdatasheet. When the subdatasheet is open,
you can view and update the related data.

Figure 2-8: Data in a subdatasheet.

Access the Checklist tile on your LogicalCHOICE course screen for reference
information and job aids on How to View Data from Related Tables

Lesson 2: Joining Tables | Topic D


40 | Microsoft® Office Access® 2013: Part 2

ACTIVITY 2-4
Modifying Data in a Subdatasheet

Before You Begin


My CheeseEmporium_2.accdb is open.

Scenario
Products are maintained in the tblProducts table. You would like to see what products are included
in each category. You need to change the price of one product, plus you want to add a new product.
You will use a subdatasheet do this without opening multiple tables.

1. Create a subdatasheet.
a) In the Navigation pane, double-click tblCategories to open the table.
b) Select HOME→Records→More, point to Subdatasheet, and then select Subdatasheet.
c) In the Insert Subdatasheet dialog box, select tblProducts and select OK.
d) In the Microsoft Access message box, select Yes.

e) Observe that a plus sign (+) appears for each record in the column to the left of the CategoryNo
column.

2. View the products in a category.


a) To the left of CategoryNo2, select the plus sign (+) to expand the subdatasheet.
b) Observe that the plus sign changes to a minus sign. In the subdatasheet, observe that three
products are listed.

Lesson 2: Joining Tables | Topic D


Microsoft® Office Access® 2013: Part 2 | 41

c) To the left of CategoryNo2, select the minus sign (–) to collapse the subdatasheet.
d) To the left of CategoryNo6, select the plus sign (+) to expand the subdatasheet.

3. Modify the data in a subdatasheet and verify the change.


a) In the subdatasheet for CategoryNo6, for the record that has ProductID P0009, in the ProductName
column, double-click the text Swiss, and press the Delete key twice to remove the word and the
space.
b) Place the insertion point after the text Almond, press the Spacebar, type Swiss and press Enter.
c) Select the ProductID column's fourth cell to prepare to add a new entry. Type P0021 and press Tab,
type Horseradish and press Tab, type 1 and press Enter.

d) Save the changes.


e) In the Navigation pane, double-click tblProducts to open the table.
f) Observe that for ProductID P0009, the name is changed to Almond Swiss.
g) Observe that a ProductID P0021 has been added, the ProductName is Horseradish, and the
UnitPrice is $1.00.
h) Close the tblProducts and the tblCategories tables.

Lesson 2: Joining Tables | Topic D


42 | Microsoft® Office Access® 2013: Part 2

TOPIC E
Create Subqueries
Creating advanced queries expands your ability to get exactly the data you need. In this topic, you
will create subqueries. A subquery is a powerful and flexible tool to filter your data.
This brief introduction to
SQL may raise more
questions than can be Subqueries
answered at this time, so
this topic is optional. Access uses Structured Query Language (SQL) behind the scenes of query Design view. If you
Consider returning to it create a query to select subsets of data from a table and then look in SQL view, you will see a
at a later time. SELECT statement. A subquery is a SELECT statement within a SELECT statement. You can write
Subquery Example a subquery in an expression in the Criteria row of the query grid or in SQL view.
Note: You can also have a subquery in the Field row of the query grid, although it is not
recommended.

A subquery appears within the parentheses in the following example:

Figure 2-9: A subquery in SQL.

The main query retrieves a list of employee names and their salaries from the Employees table. The
subquery then takes from that list the three highest paid employees and puts them in a separate table
aliased as Stars.
A subquery entered as an expression follows:
Subquery Expression
Example

Figure 2-10: A subquery entered in query Design view.

This subquery selects all of the employee IDs where the employee does not have a job title of
Supervisor, and supplies that result set to the main query.
Note: You can learn more about SQL by building queries in the query Design view and then
looking at the SQL that Access generates in SQL view.

Lesson 2: Joining Tables | Topic E


Microsoft® Office Access® 2013: Part 2 | 43

Subquery Syntax
The general syntax for a subquery is:

SELECT "column_name1"
FROM "table_name"
WHERE "column_name2" IN
(SELECT "column_name1"
FROM "table_name"
WHERE [Condition]);

The first SELECT statement is the main query, and the SELECT statement within the parentheses
is the subquery.

Access the Checklist tile on your LogicalCHOICE course screen for reference
information and job aids on How to Create Subqueries

Lesson 2: Joining Tables | Topic E


44 | Microsoft® Office Access® 2013: Part 2

ACTIVITY 2-5
Creating Subqueries

Before You Begin


My CheeseEmporium_2.accdb is open.

Scenario
The tblProducts table lists the unit price of products. The sales manager wants a list of all products
whose unit price is $4 or less.

1. Create a new query in Design view.


a) Select CREATE→Queries→Query Design.
b) In the Show Table dialog box, on the Tables tab, select tblProducts, select Add, and then select
Close.
c) Add the ProductName and UnitPrice fields to the query grid.
d) Run the query.
e) Observe that there are 21 records, and the price of Colby is $4.
f) Switch to Design view.

2. Create a subquery by using the UnitPrice field's Criteria row.


a) In the query design grid, in the UnitPrice field's Criteria row, right-click and select Zoom to display
the Zoom dialog box.
b) If a Microsoft Access Security Notice dialog box appears, select Open to open the Zoom dialog box.
c) In the Zoom dialog box, type <=(SELECT [UnitPrice] FROM [tblProducts] WHERE [ProductName]=
"Colby")

Caution: Carefully type the characters and spacing as shown. Capitalization is


not necessary.

d) Select OK.

3. Look in SQL view.

a) On the right side of the status bar, select the SQL View button.
b) Observe the SQL syntax.
c) On the right side of the status bar, select the Design View button.

4. Test the query.


a) Run the query.
Assist students in b) Observe that there are 14 records whose unit prices are less than or equal to the unit price for Colby
locating their typing ($4).
errors if their queries c) Save the query as qrySubquery
won't run. d) Close the query and the database.

Lesson 2: Joining Tables | Topic E


Microsoft® Office Access® 2013: Part 2 | 45

Summary
In this lesson, you retrieved and displayed data by using different types of joins, viewed related data
from another table, and created subqueries. This enabled you to examine required data with ease.
Are there any join types that you have not been using that you will start using now?
A: Answers will vary, but may include not being aware of self joins to retrieve related data from within
tables, or the differences between the left and right outer joins.

Can you think of some scenarios in the workplace for using subqueries?
A: Answers will vary, but may include finding the top customers who have shopped at your store during a
certain period, identifying customers who haven't ordered during a specified time frame, or pinpointing
which employees haven't made a recent sale.

Note: Check your LogicalCHOICE Course screen for opportunities to interact with your
classmates, peers, and the larger LogicalCHOICE online community about the topics covered in
this course or other topics you are interested in. From the Course screen you can also access
available resources for a more continuous learning experience.

Encourage students to
use the social
networking tools
provided on the
LogicalCHOICE Home
screen to follow up with
their peers after the
course is completed for
further discussion and
resources to support
continued learning.

Lesson 2: Joining Tables |


3 Organizing a Database
for Efficiency
Lesson Time: 50 minutes

Lesson Objectives
In this lesson, you will organize a database for efficiency. You will:
• Use the Table Analyzer Wizard.
• Create a junction table.
• Modify table structure.

Lesson Introduction
You want a database that is easy to understand and allows for speedy retrieval of data. In
this lesson, you will examine the process for determining if your tables are structured
correctly, ways to alleviate redundancy, and how to make changes to the existing design.
48 | Microsoft® Office Access® 2013: Part 2

TOPIC A
Data Normalization
Data normalization is the process of determining what data should be stored in each database table.
In this topic, you will go over the rules for normalization as well as use the Table Analyzer Wizard
to create new tables that follow these rules, so that you have a database that allows for consistent
storage and efficient access of data.

First Normal Form


First Normal Form The first normal form (1NF) says: (a) each cell of a table must contain a single value, and (b) the table
must not contain repeating groups. For example, you cannot have a field named Phone in which
you place more than one phone number. Also, you cannot create multiple identical columns named
Phone1, Phone2, and so on. You need to extract the phone numbers from that table and put them
in a new table.

Figure 3-1: The first normal form.

Second Normal Form


Second Normal Form The second normal form (2NF) should satisfy the first normal form and each field must depend on the
entire primary key. This applies to a table having a composite key. If your table has a single-field
primary key, skip to the third normal form. For example, if any of the fields in a table are dependent
on just part of the primary key, then those fields are moved out to another table.

Lesson 3: Organizing a Database for Efficiency | Topic A


Microsoft® Office Access® 2013: Part 2 | 49

Figure 3-2: The second normal form.

In the previous figure, the primary key is a composite of OrderID and OrderItem#. Given the
OrderID, you know the customer and date of the order, without having to know the OrderItem#.
Therefore, the CustomerID and OrderDate columns are not dependent upon the entire primary
key and the table is not 2NF. You need to put everything that applies to each order in one table and
everything that applies to each order item in another table.

Third Normal Form


The third normal form (3NF) should satisfy the first and second forms and each field must depend Third Normal Form
only on the single-field primary key. For example, if a field in the table is dependent on a field other
than the primary key field, then it is moved to a new table.

Lesson 3: Organizing a Database for Efficiency | Topic A


50 | Microsoft® Office Access® 2013: Part 2

Figure 3-3: The third normal form.

In the previous figure, HourlyRate is dependent on RateCategory, not EmployeeID, so to satisfy


3NF you would remove HourlyRate and place it in a new table.

Denormalization
Denormalization Denormalization is selectively adding redundant data back to a normalized table to speed up data
retrieval. When data is spread across multiple tables, you need numerous query joins to retrieve that
data. This can hinder performance in large databases. The key is to strike a balance between
redundant information and database optimization.

Figure 3-4: A table that fits denormalization.

In the previous figure, the table is not in third normal form. The City and State are dependent on
the Zip, not the Company. To achieve 3NF, two separate tables would need to be created—one
containing the Company and Zip and another one containing City, State, and Zip. So instead of
attaining normalization, you might consciously elect to keep this information in a single location that
is quickly accessible. Data normalization is a design goal, but may not always be practical.

Lesson 3: Organizing a Database for Efficiency | Topic A


Microsoft® Office Access® 2013: Part 2 | 51

The Table Analyzer Wizard


The Table Analyzer Wizard is an analysis tool that scans a table's structure for duplicate data. If it Table Analyzer Wizard
detects redundant data, the wizard provides a mechanism to split the table into smaller, related
tables according to normalization rules. This makes the database perform more efficiently.

Figure 3-5: The results from the Table Analyzer Wizard.

Access the Checklist tile on your LogicalCHOICE course screen for reference
information and job aids on How to Use the Table Analyzer Wizard

Lesson 3: Organizing a Database for Efficiency | Topic A


52 | Microsoft® Office Access® 2013: Part 2

ACTIVITY 3-1
Running the Table Analyzer Wizard

Data Files
C:\091005Data\Organizing a Database for Efficiency\CheeseEmporium_3.accdb

Scenario
The human resources manager asks you to review an employees table she has created to see if it
meets normalization rules. You want to ensure it doesn't contain any duplicate data and you want to
determine if that data should remain in just the one table or if it should be split into multiple tables.
You decide to try using the Table Analyzer Wizard to help you perform this task.

1. Open and save the database.


a) Open the CheeseEmporium_3 database.
b) If necessary, on the Message Bar, select Enable Content.
c) Save the database as My CheeseEmporium_3
d) If necessary, on the Message Bar, select Enable Content again.

2. Run the Table Analyzer Wizard.


a) Select DATABASE TOOLS→Analyze→Analyze Table.
b) If a Microsoft Access Security Notice dialog box appears, select Open to open the wizard.
c) In the Table Analyzer Wizard, select Next. Select Next again.
d) From the Tables list box, select tblEmployees and select Next.
e) Verify that the Yes, let the wizard decide option is selected, and select Next.
f) Expand the table boxes within the wizard. Observe the groupings the wizard has created.
Ask the students if they
see how the table data 3. Rename the tables.
was split and why they
think the Table Analyzer a) If it is not already selected, select Table2, select the Rename Table button, change the name of
Wizard split the data. Table2 to tblInsurance, and select OK.
b) Select Table1 and then select the Rename Table button. Rename Table1 as tblPersonnel and select
OK.
c) Select Next.

4. Set the primary key.

a) If it is not already selected, select EmployeeID, and select the Set Unique Identifier button.
b) Select Next. Verify that the Yes, create the query option is selected, and select Finish.
c) Close Access Help.

5. Observe the tables and query.


a) Observe the open query, which is assigned the original table's name and retrieves data from the
original table.
b) Open and observe the tblPersonnel table, which holds the employee information and includes a
lookup field for the insurance.
c) Open and observe the tblInsurance table, which now holds the insurance information.
d) Observe in the Navigation pane that the original table has been renamed tblEmployees_OLD.

6. Close the open tables.

Lesson 3: Organizing a Database for Efficiency | Topic A


Microsoft® Office Access® 2013: Part 2 | 53

TOPIC B
Create a Junction Table
One of the ways you can eliminate redundancy in some of your tables is by using an intermediary
table to form a junction. In this topic, you will create a junction table. This eliminates inefficient
design that could lead to inaccurate data.

Many-to-Many Relationships
Two tables are related in a many-to-many relationship when for every record (row) in the first table, Many-to-Many
there can be many records (rows) in the second table; and for every record (row) in the second table, Relationship
there can be many records (rows) in the first table. In Access, you can create a many-to-many
relationship by first creating two one-to-many relationships. To relate the tables, you would create a
third, linking table.
For example, you have Orders and Products tables. For each record in the Orders table, there can
be many records in the Products table. For each record in the Products table, there can be many
records in the Orders table.

Figure 3-6: A many-to-many relationship.

Junction Tables
A junction table is used to create a many-to-many relationship between two tables. The junction table Junction Table
usually has a composite key that consists of both foreign keys from the other tables.
Using the example of the Orders and Products tables, if you added the OrderID field to the
Products table and the ProductID field to the Orders table, you would have repeating information
in each table because a single order can include more than one product, and a single product can
appear on many orders. To solve this inefficient design problem, you need to create a junction table.

Lesson 3: Organizing a Database for Efficiency | Topic B


54 | Microsoft® Office Access® 2013: Part 2

Figure 3-7: A junction table in a many-to-many relationship.

Access the Checklist tile on your LogicalCHOICE course screen for reference
information and job aids on How to Create a Junction Table

Lesson 3: Organizing a Database for Efficiency | Topic B


Microsoft® Office Access® 2013: Part 2 | 55

ACTIVITY 3-2
Creating a Many-to-Many Relationship

Before You Begin


My CheeseEmporium_3.accdb is open.

Scenario
You have been asked to create a list of products ordered by CustomerID. Your coworker has
created a junction table for you named tblOrderDetails. You need to create two one-to-many
relationships by using this linking table.

1. Open tblOrderDetails and set the composite key.


a) Open the tblOrderDetails table in Design view.
b) While pressing Shift, select the row selector boxes for the OrderID and ProductID fields.
c) Select DESIGN→Tools→Primary Key.
d) Observe that a junction table can include additional fields (such as Discount in this case).
e) Save and close the table.

2. Run the existing query.


a) Open the qryJunction query in Design view.
b) Observe that the tblOrders and tblProducts tables do not now share a common field.
c) Run the query.
d) Observe that 315 records are displayed. This is because, in the absence of a join, every record from
both tables is combined.

3. Add tblOrderDetails to the query.


a) Switch to Design view.
b) Select DESIGN→Query Setup→Show Table.
c) In the Show Table dialog box, on the Tables tab, select tblOrderDetails, select Add, and then select
Close.

4. Drag the title bar of the tables as needed so that tblOrderDetails is in between tblOrders and
tblProducts.

5. Create relationships.
a) Drag the OrderID field from tblOrders to tblOrderDetails.
b) Drag the ProductID field from tblOrderDetails to tblProducts.

6. Run the query.

7. Observe that 33 records are displayed.

8. Save and close the query.

Lesson 3: Organizing a Database for Efficiency | Topic B


56 | Microsoft® Office Access® 2013: Part 2

TOPIC C
Improve Table Structure
The structure of your tables is the foundation upon which you built your database. You followed
proper design concepts and complied with normalization rules. Over time, business needs change.
You may want to expand your database or revamp it to fix or improve it. In this topic, you will
improve table structure to meet a target design. Following these steps will save time and make it easy
to manage changes.

Access the Checklist tile on your LogicalCHOICE course screen for reference
information and job aids on How to Improve the Table Structure

Lesson 3: Organizing a Database for Efficiency | Topic C


Microsoft® Office Access® 2013: Part 2 | 57

ACTIVITY 3-3
Improving Table Structure

Before You Begin


My CheeseEmporium_3.accdb is open.

Scenario
One of your colleagues added the SupplierID field to the tblCategories table. He realized this is a
poor design—limiting the number of suppliers for each category. He needs your help to clean up
the tblCategories table.

1. Observe the fields in the tblCategories table.


a) Open the tblCategories table and observe that the SupplierID field and data still need to be removed
from this table.
b) Close the tblCategories table.

2. Copy the structure of the existing table to a new table and name it.
a) In the Navigation pane, select the tblCategories table, and select HOME→Clipboard→Copy.
b) Select HOME→Clipboard→Paste.
c) In the Paste Table As dialog box, in the Table Name text box, type CategoriesNew
d) In the Paste Options section, select the Structure Only option and select OK.

3. Delete SupplierID from the table.


a) Open the CategoriesNew table in Design view.
b) Delete the SupplierID field.
c) In the Microsoft Access dialog box, select Yes to permanently delete the field and the data.

d) Save and close the table.

4. Create an append query to move the required data to the new table.
a) Create a new query in Design view.
b) Add tblCategories to the query.
c) Close the Show Table dialog box.
d) Add the CategoryNo and CategoryDesc fields to the design grid.
e) Select DESIGN→Query Type→Append.
f) In the Append dialog box, from the Table Name drop-down list, select CategoriesNew and select
OK.

Lesson 3: Organizing a Database for Efficiency | Topic C


58 | Microsoft® Office Access® 2013: Part 2

g) Run the query.


h) In the Microsoft Access dialog box, select Yes to append the records.

i) Close the query design window without saving the design.


j) Open CategoriesNew, verify that there are eight records, and close the table.

5. Delete tblCategories from the database and empty the Clipboard.

6. Rename Categories New to tblCategories

7. Close the database.

Lesson 3: Organizing a Database for Efficiency | Topic C


Microsoft® Office Access® 2013: Part 2 | 59

Summary
In this lesson, you got acquainted with the first three rules of data normalization, used the Table
Analyzer Wizard to create new tables that follow those rules, and improved database performance
by restructuring existing data in a database. The result is minimal data redundancy.
Do you feel it is an absolute necessity that every table in your database reach 3NF?
A: Answers will vary, but at a minimum, designers should strive for 1NF. There are times it is okay to
denormalize data such as when it makes sense, coworkers request it, or processing time is a
concern.

Can you think of any many-to-many relationships in your workplace?


A: Answers will vary, but may include a projects database, as many employees can be working on many
different projects.

Note: Check your LogicalCHOICE Course screen for opportunities to interact with your
classmates, peers, and the larger LogicalCHOICE online community about the topics covered in
this course or other topics you are interested in. From the Course screen you can also access
available resources for a more continuous learning experience.

Encourage students to
use the social
networking tools
provided on the
LogicalCHOICE Home
screen to follow up with
their peers after the
course is completed for
further discussion and
resources to support
continued learning.

Lesson 3: Organizing a Database for Efficiency |


4 Sharing Data Across
Applications
Lesson Time: 50 minutes

Lesson Objectives
In this lesson, you will share data across applications. You will:
• Import data into Access.
• Export data to text file formats.
• Export Access data to Excel.
• Create a mail merge.

Lesson Introduction
There may be occasions when you receive or distribute data in different file formats.
Microsoft Access enables you to integrate data with other programs. In this lesson, you will
import external data into Access as well as export Access data to other applications.
62 | Microsoft® Office Access® 2013: Part 2

TOPIC A
Import Data into Access
When you create a database, you can type the records into Access tables directly, or you can get the
data from another source or application. In this topic, you will import external data into Access so
you do not have to manually key it in. This will save you time and minimize errors.

Data Importing
EXTERNAL DATA Tab Importing data is the process used to bring in a copy of data from an external source. Often, data that
—Import & Link Group you want to add to Access exists in other files, such as Word documents, Excel® spreadsheets, text
files, Outlook® files, or another Access database. You can see all the different data formats that
Access can import by looking at the EXTERNAL DATA tab on the ribbon.

Figure 4-1: The EXTERNAL DATA tab's Import & Link group.

Access web apps also support importing data from a variety of sources. These include: Access
desktop database, Excel file, ODBC data source, text file, or SharePoint List. When importing to an
Access web app, Access creates the database for you. The data is added, the database schema is
automatically defined, relationships are retained, views are generated, and the navigation is created.
Note: For a way to import data while maintaining a connection to the original file, see the
LearnTO Import a Linked Table presentation from the LearnTO tile on your
LogicalCHOICE Course screen.

You may want to show


LearnTO Import a
Linked Table from the The Get External Data Wizard
LogicalCHOICE Course
screen or have students In most cases, the Get External Data wizard starts when you choose an option from the Import &
navigate out to the Link group of the EXTERNAL DATA ribbon tab. You can specify the data source and its
Course screen and destination. You can choose whether to import the data into a new table or append it to an existing
watch it themselves as a table. You can elect to link to the source file to get automatic updates any time changes are made to
supplement to your the original.
instruction. If not, please
remind students to visit Note: When you import a file, it is like taking a snapshot of it at that moment in time.
the LearnTOs for this
course on their
LogicalCHOICE Course
screen after class for
supplemental
information and
additional resources.
Get External Data
Wizard

Lesson 4: Sharing Data Across Applications | Topic A


Microsoft® Office Access® 2013: Part 2 | 63

Figure 4-2: The Get External Data Wizard for importing a text file.

Delimiters
When importing data from other formats into an Access table, the data needs to be structured so it
can be used. Delimiters are single characters used to separate fields of data from each other. Common
delimiters are paragraph marks, tabs, and commas. For instance, if you are importing a text file or
spreadsheet, the columnar data may be separated by commas. If so, that file format would be
referred to as CSV, or comma-separated values.

Access the Checklist tile on your LogicalCHOICE course screen for reference
information and job aids on How to Import Data into Access

Lesson 4: Sharing Data Across Applications | Topic A


64 | Microsoft® Office Access® 2013: Part 2

ACTIVITY 4-1
Importing Data from a Text File

Data Files
C:\091005Data\Sharing Data Across Applications\CheeseEmporium_4.accdb
C:\091005Data\Sharing Data Across Applications\Suppliers.txt

Scenario
Your supervisor has sent you a text file that lists some new suppliers. You want to add this
information to your existing tblSuppliers table without typing it in. Because you anticipate receiving
data like this on a regular basis, you want to automate this task so you can use it again.

1. Open and save the database.


a) Open the CheeseEmporium_4 database.
b) If necessary, on the Message Bar, select Enable Content.
c) Save the database as My CheeseEmporium_4
d) If necessary, on the Message Bar, select Enable Content again.

2. View an existing table.


a) Open tblSuppliers.
b) Observe that there are eight records.
c) Close the table.

3. Specify the text file to be imported.


a) Select EXTERNAL DATA→Import & Link→Text File.
b) In the Get External Data – Text File Wizard, in the Specify the source of the data section, select
Browse.
c) In the File Open dialog box, navigate to the C:\091005Data\Sharing Data Across Applications
\Suppliers.txt file and select Open.
d) In the Specify how and where you want to store the data in the current database section, select
Append a copy of the records to the table. From the drop-down list, select tblSuppliers and select
OK.
e) If a Microsoft Access Security Notice dialog box appears, select Open to open the wizard.

4. Import the data and save the import specifications.


a) In the Import Text Wizard, on the Your data seems to be in a 'Delimited' format page, verify that the
Delimited - Characters such as comma or tab separate each field option is selected, and select
Next.
b) In the Choose the delimiter that separates your fields section, verify that the Comma option is
selected, if necessary, uncheck the First Row Contains Field Names check box and select Next.

c) On the That's all the information the wizard needs to import your data page, select Finish.

Lesson 4: Sharing Data Across Applications | Topic A


Microsoft® Office Access® 2013: Part 2 | 65

d) In the Get External Data – Text File Wizard, check the Save import steps check box to save the
import steps.
e) In the Save as text box, verify that Import-Suppliers is displayed, and select Save Import.

5. View the imported data.


a) Open the tblSuppliers table.
b) Observe that 4 suppliers have been imported from the text file to make a total of 12 records.
c) Close the table.
Consider asking
students for examples of
when they might need to
import data from a text
file.

Lesson 4: Sharing Data Across Applications | Topic A


66 | Microsoft® Office Access® 2013: Part 2

ACTIVITY 4-2
Importing Data from an Excel File

Data Files
C:\091005Data\Sharing Data Across Applications\Payables.xlsx

Before You Begin


My CheeseEmporium_4.accdb is open.

Scenario
Your supervisor has sent you a spreadsheet that contains accounts payable information. You want to
import this data to a new table in your database.

1. Specify the Excel file to be imported.


a) Select EXTERNAL DATA→Import & Link→Excel.
b) In the Get External Data – Excel Spreadsheet Wizard, in the Specify the source of the data section,
select Browse.
c) Open thePayables.xlsx file.
d) In the Specify how and where you want to store the data in the current database section, verify that
Import the source data into a new table in the current database option is selected, and select OK.

2. Import the worksheet data.


a) In the Import Spreadsheet Wizard, on the Your spreadsheet file contains more than one worksheet
or range page, verify that the Show Worksheets option is selected and that, in the list box, Sheet1 is
selected. Select Next.
b) On the Microsoft Access can use your column headings as field names for your table page, check
the First Row Contains Column Headings check box, if necessary, and select Next.
c) On the You can specify information about each of the fields you are importing page, in the Field
Options section, verify that in the Field Name text box, Supplier is displayed, and that in the Data
Type drop-down list, Short Text is selected.
d) Select the other column headings at the bottom of the page to see the options Access chose.
e) Select Next.
f) On the Microsoft Access recommends that you define a primary key for your new table page, select
the Choose my own primary key option, and from the drop-down list, select Supplier if necessary.
Select Next.
g) On the That's all the information the wizard needs to import your data page, in the Import to Table
text box, rename Sheet1 as tblPayables, and select Finish.
h) In the Get External Data – Excel Spreadsheet Wizard, leave the Save import steps check box
unchecked. Select Close.

3. View the imported data.


a) Open the tblPayables table.
b) Observe that the data has been imported into the table from the Excel file.
c) Close the table.
Consider asking
students for examples of
when they might need to
import data from an
Excel file.

Lesson 4: Sharing Data Across Applications | Topic A


Microsoft® Office Access® 2013: Part 2 | 67

TOPIC B
Export Data to Text File Formats
You may want to transfer your Access data to a CSV or other text format. In this topic, you will
export Access data to text files. If you need to export your data to a program that Access does not
support directly, converting it to text should enable the other program to open it.

Data Exporting
Exporting data is the process used to send out a copy of data from one application to another. EXTERNAL DATA Tab
Exporting the data in a table or query is a common task. On the ribbon, on the EXTERNAL —Export Group
DATA tab, in the Export group, you can see all the different data formats that Access can export
to. Access exports to the same formats that it imports.

Figure 4-3: The EXTERNAL DATA tab's Export group.

Note: Remember, you can export objects like reports to a Portable Document Format (PDF) to
preserve their original formatting.

Access the Checklist tile on your LogicalCHOICE course screen for reference
information and job aids on How to Export to Text File Formats

Lesson 4: Sharing Data Across Applications | Topic B


68 | Microsoft® Office Access® 2013: Part 2

ACTIVITY 4-3
Exporting Data to Text File Formats

Before You Begin


My CheeseEmporium_4.accdb is open.

Scenario
Your supervisor has asked you to export the self join query that you created previously to a text file
so that human resources has an updated list of who supervises whom. You aren't sure which options
produce output that is easier for a user to read, so you will experiment with a couple of them.

1. Export the query as a delimited file.


a) Select the qrySelfJoin query.
b) Select EXTERNAL DATA→Export→Text File.
c) In the Export - Text File Wizard, in the Specify the destination file name and format section, modify
the last part of the file name to read qrySelfJoinDelimited.txt and select OK. You are not choosing
anything in the Specify export options section.
d) In the Export Text Wizard, on the This wizard allows you to specify details on how Microsoft Access
should export your data page, verify that the Delimited - Characters such as comma or tab separate
each field option is selected.

e) Select Next.
f) On the What delimiter separates your fields page, in the Choose the delimiter that separates your
fields section, verify that Comma is selected.
g) Check the Include Field Names on First Row check box.
h) Select Next.
i) Select Finish.
j) Close the Export - Text File Wizard without saving the export steps.

2. View the exported file.


a) Navigate to the qrySelfJoinDelimited.txt file you just created.

Note: In this step, you will navigate to the text file located on your file system,
not in Access. Open Windows Explorer or something similar to locate the text
file.
b) Double-click the file to open it in Notepad.
c) Observe that each record appears on its own line, and the fields are separated by the delimiter you
chose (comma). This is not easily readable.

Lesson 4: Sharing Data Across Applications | Topic B


Microsoft® Office Access® 2013: Part 2 | 69

d) Close the file.

3. Export the query as a text file with formatting.


a) Select the qrySelfJoin query.
b) Select EXTERNAL DATA→Export→Text File.
c) In the Export - Text File Wizard, in the Specify the destination file name and format section, verify
that the last part of the file name reads qrySelfJoin.txt.
d) In the Specify export options section, check the Export data with formatting and layout check box.
e) Check the Open the destination file after the export operation is complete check box.

f) Select OK.
g) In the Encode 'qrySelfJoin' As dialog box, verify that Windows (default) is selected, and then select
OK.

h) Access exports the data. Observe that pipe characters (|) are used to organize the content in a grid.
This is easily readable.
i) Close the file.
j) Close the Export - Text File Wizard without saving the export steps.
Consider asking
students for examples of
when they might need to
export data to a text file.

Lesson 4: Sharing Data Across Applications | Topic B


70 | Microsoft® Office Access® 2013: Part 2

TOPIC C
Export Access Data to Excel
You might export an Access table or query to Excel to perform further analysis. You can also export
selected records from an open datasheet. The conversion process is straightforward. It's probably
better to send someone a spreadsheet containing exactly the data they need, rather than to send
them the entire database. In this topic, you will export Access data to Excel so you can share data
with someone unfamiliar with Access.

Access the Checklist tile on your LogicalCHOICE course screen for reference
information and job aids on How to Export Access Data to Excel

Lesson 4: Sharing Data Across Applications | Topic C


Microsoft® Office Access® 2013: Part 2 | 71

ACTIVITY 4-4
Exporting Data to Excel

Before You Begin


My CheeseEmporium_4.accdb is open. Microsoft Excel is installed and will be used for this activity.

Scenario
You previously imported the payables from Excel into Access. You want to make some updates to
the file and see how much is owed, but the formulas have been removed. You will export it back to
Excel and make changes.
Prepare learners that
they will use Excel in this
1. Export the table as an Excel file with formatting. activity.
a) Select the tblPayables table.
b) Select EXTERNAL DATA→Export→Excel.
c) In the Export - Excel Spreadsheet Wizard, in the Specify the destination file name and format
section, modify the last part of the file name to read tblPayablesExport.xlsx.
d) In the Specify export options section, check the Export data with formatting and layout check box.
e) Check the Open the destination file after the export operation is complete check box. Then select
OK.
f) Close the Export – Excel Spreadsheet Wizard without saving the export steps.

Note: The Export - Excel Spreadsheet Wizard may be behind the


tblPayablesExport.xlsx window.

2. Modify the Excel file.


a) Switch to tblPayablesExport.xlsx.
b) Select cell C5. Type 2100 and press Enter.
c) Select cell C7. Type 1351.28 and press Enter.
d) Select cell D2. Type =B2-C2 and press Ctrl+Enter (to stay in the active cell).
e) Double-click the fill handle to copy the formula down the column. Consider asking
students for examples of
when they might need to
export data to an Excel
file.

f) Click in a blank cell and observe that the Owed column is updated.

Lesson 4: Sharing Data Across Applications | Topic C


72 | Microsoft® Office Access® 2013: Part 2

3. Save and close the Excel file, and then exit Excel.

Lesson 4: Sharing Data Across Applications | Topic C


Microsoft® Office Access® 2013: Part 2 | 73

TOPIC D
Create a Mail Merge
Your Access database probably contains the names and addresses of customers, employees, and
other business contacts. By combining Word with an Access table or query, you can create
personalized documents quickly and easily. In this topic, you will create a mail merge. It is much
more efficient to merge Access data with Word documents than it is to reenter all the information
into Word.

The Microsoft Word Mail Merge Wizard


The Microsoft Word Mail Merge Wizard allows you to create a direct link between an Access table or Microsoft Word Mail
query, referred to as the data source, and a Word document, referred to as the main document. The Merge Wizard
wizard will help you create form letters, mailing labels, envelopes, and other documents. You access
the wizard by selecting EXTERNAL DATA→Export→Word Merge.

Figure 4-4: The Microsoft Word Mail Merge Wizard.

Merge Fields
The mail merge process inserts the fields from the database into predefined merge points in the Merge Fields
main document. You select the merge fields in Word by selecting MAILINGS→Write & Insert
Fields→Insert Merge Field.

Lesson 4: Sharing Data Across Applications | Topic D


74 | Microsoft® Office Access® 2013: Part 2

Figure 4-5: Merge fields used for a mail merge.

The Mail Merge Task Pane


The Mail Merge Task The Mail Merge task pane in Word guides you through a series of six steps to complete the mail
Pane merge. You open this pane by selecting MAILINGS→Start Mail Merge→Step by Step Mail
Merge Wizard.

Lesson 4: Sharing Data Across Applications | Topic D


Microsoft® Office Access® 2013: Part 2 | 75

Figure 4-6: Step 3 of 6 displaying in the Mail Merge task pane.

Access the Checklist tile on your LogicalCHOICE course screen for reference
information and job aids on How to Create a Mail Merge

Lesson 4: Sharing Data Across Applications | Topic D


76 | Microsoft® Office Access® 2013: Part 2

ACTIVITY 4-5
Merging Access Data with a Word Document

Data Files
C:\091005Data\Sharing Data Across Applications\Customer Letter.docx

Before You Begin


My CheeseEmporium_4.accdb is open. Microsoft Word is installed and will be used for this activity.

Scenario
The sales director would like your help to send a letter. Using the customer names and addresses
stored in the database, she would like you to personalize the document with a mail merge.
Prepare learners that
they will use Word in this
activity. 1. Start the Microsoft Word Mail Merge Wizard.
a) Select the tblCustomers table.
b) Select EXTERNAL DATA→Export→Word Merge.
c) If a Microsoft Access Security Notice dialog box appears, select Open to open the wizard.
d) In the Microsoft Word Mail Merge Wizard, verify that Link your data to an existing Microsoft Word
document option is selected, and select OK.
e) In the Select Microsoft Word Document dialog box, select the C:\091005Data\Sharing Data across
Applications\Customer Letter.docx file and select Open.

2. Add mail merge fields for the customer's name, address, city, state, zip, and salutation.
a) Switch to Microsoft Word, and maximize the window if desired.
b) In Microsoft Word, in the Mail Merge task pane, in the Select recipients section, verify that the Use
an existing list option is selected.
c) In the task pane, select the Next: Write your letter link.

d) In the Word document, place the cursor in front of the D in Dear.


e) Select MAILINGS→Write & Insert Fields→Insert Merge Field.

Caution: Make sure you select the top portion of the button.

f) In the Insert Merge Field dialog box, in the Fields list box, select FirstName and select Insert.
g) Add LastName, Address, City, State, and Zip in this same manner. Select Close.
h) Format the fields by adding spaces, commas, and pressing Enter as needed so the fields match the
following:

Lesson 4: Sharing Data Across Applications | Topic D


Microsoft® Office Access® 2013: Part 2 | 77

i) On the Dear line, place the cursor in front of the colon (:) and after the space, and select
MAILINGS→Insert Merge Field→FirstName.

Caution: Make sure you select the bottom portion of the button.

3. Preview the letters.


a) In the Mail Merge task pane, select the Next: Preview Your Letters link.
b) Verify that the merge fields have been replaced with customer information from the first record in the
table.

Note: If you need to make corrections, select the Previous: Write your letter
link.
c) In the Mail Merge task pane, in the Preview your letters section, select the Find a recipient link.
d) In the Find Entry dialog box, type CT (in capital letters). In the Look In section, select This field and
select State. Select Find Next, and then select Cancel.
e) Verify that the customer from Connecticut is shown.

4. Complete the merge.


a) In the Mail Merge task pane, select the Next: Complete the merge link.
b) In the Merge section, select the Print link.
c) Observe that the Merge to Printer dialog box is displayed. Select Cancel.
d) Save the document as My Customer Letter in the current folder and close it. Exit Word.

Note: If a Microsoft Word dialog box asks if you want to save to the new file
format, select OK.

5. Close the database.

Lesson 4: Sharing Data Across Applications | Topic D


78 | Microsoft® Office Access® 2013: Part 2

Summary
In this lesson, you shared Access data across several formats such as text files, Excel, and Word.
This allowed you to extend your ability to analyze and combine data without having to reenter it.
Which importing features might you use in your workplace?
A: Answers will vary, but a common task will probably be to import from Excel. Additionally, text files as
well as other Access databases can be imported. Data can be appended to existing tables, or new
tables can be created. If information changes frequently, choosing to link files would be the best
option.

Which exporting features might you use in your workplace?


A: Answers will vary, but common tasks will probably be to export to Excel for analysis and Word for mail
merge. Exporting with formatting will be probably be the norm. Converting to a CSV file to make it
compatible with most applications will be invaluable. Linking files will occur as well.

Note: Check your LogicalCHOICE Course screen for opportunities to interact with your
classmates, peers, and the larger LogicalCHOICE online community about the topics covered in
this course or other topics you are interested in. From the Course screen you can also access
available resources for a more continuous learning experience.

Encourage students to
use the social
networking tools
provided on the
LogicalCHOICE Home
screen to follow up with
their peers after the
course is completed for
further discussion and
resources to support
continued learning.

Lesson 4: Sharing Data Across Applications |


5 Advanced Reporting
Lesson Time: 2 hours, 10 minutes

Lesson Objectives
In this lesson, you will customize reports to organize the displayed information and produce
specific print layouts. You will:
• Organize report information.
• Format a report.
• Add a data bar to a report.
• Add a calculated field to a report.
• Add a subreport to an existing report.

Lesson Introduction
Reports can be customized to make them more effective. In this lesson, you will organize
the displayed information and produce specific print layouts.
80 | Microsoft® Office Access® 2013: Part 2

TOPIC A
Organize Report Information
Reports that use grouping or display summary information are easier to understand. In this topic,
you will organize information this way. You'll expand upon simple report designs to create
attractive, informative printouts.

Report Design Elements


Report Controls Group When you look at a report in Design or Layout view, Access displays controls grouped into
sections.
Use controls to create the look of the report:
• Where the report elements (such as text, lines, or logos) will be put on the printed page
• How each element will be formatted
Controls are available in Design view from the REPORT DESIGN TOOLS contextual tab in the
Controls group of the DESIGN tab. Some of the controls, such as check boxes and option
buttons, are intended more for forms than reports.

Figure 5-1: Some of the controls that can be added to jazz up reports.

Some Controls The following table describes the available controls.

Control Purpose

Text Box Holds text that changes.


Label Holds fixed text. Often accompanies a text box to show readers what
data they're looking at.
Hyperlink Holds links to websites.
Page Break Lets you split the Detail section into separate pages.
Combo Box Lets you insert a drop-down box.
Image Holds a picture.
Line Lets you draw vertical, horizontal, or diagonal lines. Helps separate
content graphically.
Rectangle Lets you draw formatted rectangles around other controls. Helps content
stand out.
Subform/Subreport Lets you insert a subform or subreport.
Button Lets you insert a button.
Tab Control Lets you add tab control.

Lesson 5: Advanced Reporting | Topic A


Microsoft® Office Access® 2013: Part 2 | 81

Control Purpose
Option Group Lets you insert a option group.
Toggle Button Lets you insert a toggle button.
List Box Lets you insert a list box.
Check Box Lets you insert a check box.
Unbound Object Lets you insert an unbound object frame.
Frame
Bound Object Frame Lets you insert a bound object frame.
Attachment Lets you add an attachment.
Option Button Lets you insert an option button.

An Access report is divided into five sections. The sections determine where and how often the
elements will print. You can leave some sections blank.
• Report Header – Prints just once at the beginning of the report (the top of the first page). This
section is where you can add information that might appear on a cover page, such as the report
title, logo, or version information.
• Page Header – Prints at the top of every page (appears under the report header on the first
page). You can add the date, column headers, or design elements (lines or shaded rectangles).
• Detail – Appears once immediately after the page header in Design view, but actually repeats to
display each database record. This is the main body of the report. A report can have only this
section.
• Page Footer – Prints on the bottom of every page. It's another option instead of the page
header to add the date and page number.
• Report Footer – Prints just once at the bottom of the last page (under the page footer). You can
use it to print summary information, confidentiality statements, the name of the report author,
and contact information such as an email address or phone number.
Note: If your report doesn't have all these sections and you want to add them, right-click the
report and select Report Header/Footer or Page Header/Footer.

If you want to add design elements (such as text, lines, titles, or logos) to your report, use Design
view. If you want to format existing report elements, use Layout view.

Report Design Tools


In addition to the Controls group discussed previously, there are other useful options available on Additional DESIGN Tab
the DESIGN tab of the REPORT DESIGN TOOLS contextual tab. Groups

Group Description

Views Contains options for viewing reports in different layouts, such as Report view,
Print Preview, Layout view, and Design view.
Themes Enhances report design by adding color and changing fonts.
Grouping & Contains options for sorting, grouping, and hiding details.
Totals
Header/Footer Contains tools for inserting page numbers, a logo, a title, the date, and the time
into a report.
Tools Contains tools to display the properties of the report and change the tab order.

Lesson 5: Advanced Reporting | Topic A


82 | Microsoft® Office Access® 2013: Part 2

The Group, Sort, and


Total Pane The Group, Sort, and Total Pane
The Group, Sort, and Total pane allows you to select sort fields and grouping fields for a report. Each
report can have up to 10 grouping and sorting levels. In addition to grouping and sorting, you can
add subtotals, grand totals, and other calculations to your reports. The Group, Sort, and Total
pane is available on the DESIGN tab, in the Grouping & Totals group.

Figure 5-2: The sections of a report along with the Group, Sort, and Total pane displayed in
Design view.

Group Headers/Footers
When you group fields in a report, Access creates a group header. The group header is paired with a
group footer.
• Group Header – Prints at the beginning of each new group of records. Use the group header to
print the group name. You can have multiple group header sections in a report, depending on
how many grouping levels you have added.
• Group Footer – Prints at the end of each group of records. Use a group footer to print
summary information for a group. You can have multiple group footer sections in a report,
depending on how many grouping levels you have added.
You can keep both the group header and footer sections in your report, one or the other, or neither.

Lesson 5: Advanced Reporting | Topic A


Microsoft® Office Access® 2013: Part 2 | 83

The Field List Pane


The Field List Pane
Access supports three types of controls:
• Bound – A control whose source of data is a field in a table or query. Displays a particular field's
value in the report.
• Unbound – A control that doesn't have a source of data. Displays fixed text on the report, such
as a label.
• Calculated – A control whose source of data is an expression rather than a field. Displays the
results of a calculation, for example.
By default, a control is unbound when created. You can bind a control to a field by using the Field
List pane. Simply double-click the selected field from the pane to add it to the report. The Field
List pane is available on the DESIGN tab, in the Tools group.

Figure 5-3: The Field List pane lists fields available for insertion in a report.

Access the Checklist tile on your LogicalCHOICE course screen for reference
information and job aids on How to Organize Report Information

Lesson 5: Advanced Reporting | Topic A


84 | Microsoft® Office Access® 2013: Part 2

ACTIVITY 5-1
Making Report Design Modifications

Data Files
C:\091005Data\Advanced Reporting\CheeseEmporium_5.accdb

Scenario
You would like to design a report grouped by the InvoiceType field and sorted by the OrderDate
field. Additionally, you will use various views and tools to help organize the report information to
make it useful for your readers.
These advanced
reporting activities can
slow down some 1. Open and save the database.
students considerably. a) Open the CheeseEmporium_5 database.
Be sure to monitor their
progress, including your b) If necessary, on the Message Bar, select Enable Content.
remote students. c) Save the database as My CheeseEmporium_5
d) If necessary, on the Message Bar, select Enable Content again.

2. Create a report by using the wizard.


a) In the Navigation pane, select tblInvoices.
b) Select CREATE→Reports→Report Wizard.
c) If a Microsoft Access Security Notice dialog box appears, select Open to open the wizard.
d) On the Which fields do you want on your report page, in the Available Fields list box, select the >>
button to move all the fields to the Selected Fields list box.
e) Select Next.
f) On the Do you want to add any grouping levels page, select the < button to move CustomerID back
to the list, select InvoiceType, select the > button, and then select Next.
g) On the What sort order and summary information do you want for detail records page, from the first
drop-down list, select OrderDate, and select Next.
h) On the How would you like to lay out your report page, verify that Stepped is selected, and select
Next.
i) In the What title do you want for your report section, type Invoices By Sales Type and select Finish.
When the report is
displayed, briefly point 3. Resize columns in Layout view.
out some of issues that a) Select PRINT PREVIEW→Close Print Preview, and switch to Layout view.
students will address b) In the report, select OrderDate, and while pressing Shift, select the first ####### and drag the left
throughout the rest of edge of the control to the left to increase the width of the column until the entire date is visible.
the activity.
Some tasks in the c) Select InvoiceNo, and while pressing Shift, select 23135 and drag the right edge of the control to the
advanced reporting left so it is as wide as the column heading (InvoiceNo).
activities can be a little d) Using the same technique, adjust the width of the CustomerID column.
confusing and/or difficult
for learners to visualize.
Check in with learners
periodically to see if they
need any guidance.

Lesson 5: Advanced Reporting | Topic A


Microsoft® Office Access® 2013: Part 2 | 85

4. Add a Group Footer section with a subtotal and add a grand total to the Report Footer section.
a) Switch to Design view.
b) Select DESIGN→Grouping & Totals→Group & Sort.
c) In the group band, select More to expand it, select the without a footer section arrow, and select with
a footer section.
d) In the group band, select the with no totals arrow, and in the Total On drop-down list, select Amount.
e) In the Type box, make sure Sum is selected and check the Show Grand Total and Show subtotal in
group footer check boxes.

f) Select DESIGN→Grouping & Totals→Group & Sort to close the Group, Sort, and Total pane. If students chose to
g) Observe that the items were added to the report. close the pane by
clicking the Close
5. Move controls in Design view. Grouping Dialog Box
button, they may
a) In the Page Header section, select the Amount label, and while pressing Shift, select the following:
accidentally click the
• In the Detail section, Amount Delete button because
• In the InvoiceType Footer section, the subtotal they look similar and are
• In the Report Footer section, the grand total located near each other.
b) Release the Shift key, and move all the controls to the left (using the left arrow key) until the left Caution them about this
edge is on the 6.5-inch mark on the horizontal ruler. or recommend that they
close it from the
c) Using the same technique, move the CustomerID controls to the 5.25-inch mark, the InvoiceNo DESIGN contextual tab.
controls to the 4-inch mark, and the OrderDate controls to the 2.5-inch mark. Remind students to
d) In the Page Header section, select Amount, and while pressing Shift, select CustomerID, InvoiceNo, deselect the previous
and OrderDate. Release Shift, right-click one of the selected controls, point to Align, and then select selection before
Bottom. attempting to move other
e) Using the same technique, select the controls in the Detail section and align on the bottom. controls.

In this step, the students


should increase these
two sections a little bit
(three lines of dots each)
to give them more space
6. Increase the height of sections and add lines to the report. for controls. To do this,
a) Point to the top border of the Page Footer section and drag downward until three additional rows of have them point the
grid dots appear, and then in the InvoiceType Footer section, select the subtotal text box and, using mouse pointer at the top
the down arrow, move it down three rows of grid dots. of the section specified
where the white border
meets the dots above.

Lesson 5: Advanced Reporting | Topic A


86 | Microsoft® Office Access® 2013: Part 2

b) Select DESIGN→Controls→More. Select the Line tool, and in the InvoiceType Footer section,
position the mouse pointer's plus symbol (+) at the upper-left corner of the subtotal text box. While
pressing Shift, drag a horizontal line from left to right until the end of the line aligns with the upper-
right corner of the subtotal text box, release the mouse button, and then release the Shift key.
c) Point to the bottom border of the report and drag downward until three additional rows of grid dots
appear, and then in the Report Footer section, select the grand total text box and move it down
three rows of grid dots.
d) Select DESIGN→Controls→More. Select the Line tool, and in the Report Footer section, position the
mouse pointer's plus symbol (+) at the grid dot just above the upper-left corner of the grand total text
box. While pressing Shift, drag a horizontal line from left to right until the end of the line aligns with
the right edge of the grand total text box, release the mouse button, and then release the Shift key.
e) In the Report Footer section, right-click the selected line and then select Copy.
f) Right-click the Report Footer section bar, and then select Paste. A copy of the line is pasted in the
upper-left corner of the Report Footer section.
g) Press the down arrow key four times to move the copied line down in the section. In the Report
Footer section, select the original line, and while pressing Shift, select the copied line, release the
Shift key, right-click the copied line, point to Align, and then select Right. A double line is now
positioned above the grand total text box.

7. Save and preview the report.


a) Save the report.
b) Switch to Print Preview and view the report.

Lesson 5: Advanced Reporting | Topic A


Microsoft® Office Access® 2013: Part 2 | 87

c) Select PRINT PREVIEW→Close Print Preview.


d) Close the report.
e) Rename the report to rptInvoicesBySalesType so it conforms to the usual naming conventions.

Lesson 5: Advanced Reporting | Topic A


88 | Microsoft® Office Access® 2013: Part 2

TOPIC B
Format Reports
You may want to enhance a report's appearance. In this topic, you will format reports as well as
control pagination. This results in a professional-looking report that captures the reader's attention.

The Rich Text Property


Rich Text Property The rich text property allows you to single out an entry with different formatting such as bold,
underline, and indentation. This applies only in memo fields. In the Field Properties pane, you
need to set the Text Format property to Rich Text. The text box control that displays the memo
field inherits this property. To apply formatting options, first select the text that you want to format,
and then format it as you would in Word.

Figure 5-4: Set the Text Format property for the memo field in table Design view.

Report Format Tools


Report FORMAT You can adjust items in your report (such as fonts, colors, borders, and spacing) with the tools on
Options the FORMAT and ARRANGE contextual tabs of the REPORT TOOLS tab.

Figure 5-5: Options on the FORMAT tab to improve a report's visual appeal.

Report ARRANGE
Options

Figure 5-6: Options on the ARRANGE tab enable you to insert, split, merge, and move selected
controls in a report.

Lesson 5: Advanced Reporting | Topic B


Microsoft® Office Access® 2013: Part 2 | 89

Report Control Properties


You've fine-tuned your report's controls with the ribbon commands. Report control properties allow you Property Sheet Controls
to customize a control's settings on the Property Sheet. The Property Sheet is available in Design
view by selecting DESIGN→Tools→Property Sheet. The Format tab of the Property Sheet
contains the options you'll change most often. For instance, there are formatting and page break
selections specific to particular report sections (such as ReportHeader and PageFooterSection).

Figure 5-7: Some of the Property Sheet settings.

The following table describes some useful control properties on the FORMAT tab. Useful Control
Properties
Property Description

Can Grow When set to Yes, the control resizes vertically to fit its content.
Can Shrink When set to Yes, the control resizes vertically to fit its content without
displaying additional space.
Hide Duplicates When set to Yes, the control suppresses repeating values.

Report Pagination
When data extends from one page to the next, you'll need to pay attention to where the page breaks.
Grouping is a more efficient way to control page breaks. If you can't get the pages to break the way
you want, then add a page break in Design view by selecting DESIGN→Controls→Page Break.
Keep Together Property
The Keep Together Property Settings
The Keep Together property is used to keep parts of the group together on the same page. This property
prevents records from being displayed separately at the top of a new page. The property also
specifies whether or not a section starts printing on a new page if it won't fit entirely on the current
page. You can define the property choosing one of three settings from the More section of the
group band in the Group, Sort, and Total pane.
The three Keep Together property choices allow you to control the look of your printed report.

Lesson 5: Advanced Reporting | Topic B


90 | Microsoft® Office Access® 2013: Part 2

Setting Description

Do Not Keep Group Together On Allows the group header, detail, and group footers to
One Page print without keeping the information together on the
same page. This is the default setting.
Keep Whole Group Together On Forces the groups to print on the same page.
One Page
Keep Header And First Record Allows the group header section to print on a page only
Together On One Page if it can also print the first detail record.

Force New Page


Property Options The Force New Page Property
The Force New Page property is used to print a new page every time the group value changes. You can
control this with one of four settings on the Format tab of the Property Sheet pane.
The following table describes the four Force New Page property choices.

Setting Description

None Allows the section to be printed on the current page. This is the
default.
Before Section Forces the section to start printing at the top of a new page. The
rest of the page could be empty.
After Section Forces the following section to start printing at the top of a new
page.
Before & After Section Forces the current and following sections to start printing at the
top of new pages.

Access the Checklist tile on your LogicalCHOICE course screen for reference
information and job aids on How to Format Reports

Lesson 5: Advanced Reporting | Topic B


Microsoft® Office Access® 2013: Part 2 | 91

ACTIVITY 5-2
Formatting a Report

Before You Begin


My CheeseEmporium_5.accdb is open.

Scenario
You want to create a custom report grouped by the CategoryNo field and sorted by the ProductID
field. You will fine-tune the report by changing properties and strengthening its appearance.

1. Create a blank report and add bound controls in Layout view.


a) Select CREATE→Reports→Blank Report.
b) Select DESIGN→Tools→Property Sheet.
c) In the property sheet, select the All tab (if necessary), select the Record Source arrow, select
qryProductCategory, and then close the property sheet.
d) Select DESIGN→Tools→Add Existing Fields.
e) In the Field List pane, double-click each field in order. The five bound controls are displayed in a
tabular layout in the report.
f) Close the Field List pane.

2. Resize columns in Layout view.


a) Select ProductName to select the column, and then drag the right edge of the control to the right to The Gourmandise with
increase its width so that the longest item (Gourmandise with Walnuts) is entirely visible. Walnuts item is located
b) Select CategoryNo to select the column, and then drag the right edge of the control to the left to further down in the table,
decrease the width to the size of the column heading. Adjust the ProductID and UnitPrice columns and students will have to
the same way. scroll down to see it.

3. Set the property for the grouping field and the sort field.
a) Select DESIGN→Grouping & Totals→Group & Sort.
b) In the Group, Sort, and Total pane, select the Add a group button, and then select CategoryNo.
Access adds a Group Header section to the report and adds a group band.
c) In the Group, Sort, and Total pane, select the Add a sort button and then select ProductID.
d) In the group band, select More to expand it, select the do not keep group together on one page
arrow, and then select keep header and first record together on one page.
e) Close the Group, Sort, and Total pane.

4. Remove controls from a control layout.


Assist students in
a) Select the layout selector , which is located at the top-left corner of the column heading line. locating the layout
b) Right-click one of the selected controls, point to Layout, and then select Remove Layout. selector if they are
c) Select CategoryDesc (so it is the only control selected) and press the Delete key. having difficulty seeing
d) Switch to Print Preview to see what the report looks like. it.

Lesson 5: Advanced Reporting | Topic B


92 | Microsoft® Office Access® 2013: Part 2

e) Select PRINT PREVIEW→Close Print Preview.


f) Switch to Design view.
g) In the Detail section, select Category Desc, and use the left arrow key to move the selected control
to the 0.25-inch mark on the horizontal ruler.
h) Select FORMAT→Selection→Select All. While pressing Shift, deselect CategoryNo from both
sections and CategoryDesc. Use the left arrow key to move the selected controls to the 1.5-inch
mark on the horizontal ruler.

5. Improve the report.


a) In the CategoryNo Header section, select CategoryNo, and then select FORMAT→Font→Bold.
b) Select FORMAT→Selection→Select All. Right-click one of the selected controls and select
Properties. In the property sheet, select the Format tab, select the right side of the Border Style box,
and then select Transparent.
c) Select the Detail section bar, and then select FORMAT→Background→Alternate Row Color, and
select No Color.
d) Select the CategoryNo Header section bar. In the property sheet, on the Format tab, select the right
side of the Alternate Back Color box, and then select No color.
e) In the Detail section, select CategoryDesc. Scroll down on the property sheet and select the right
side of the Hide Duplicates box, and then select Yes.

Note: Hide Duplicates is the seventh property from the bottom.

f) Select the CategoryNo Header section bar. In the property sheet, select the right side of the Force
New Page box, and then select Before Section.
g) Close the property sheet.

Lesson 5: Advanced Reporting | Topic B


Microsoft® Office Access® 2013: Part 2 | 93

h) Select DESIGN→Header/Footer→Page Numbers. Select Page N of M, select Bottom of Page


[Footer], select the Alignment arrow, and then select Right. Verify that Show Number on First Page
is checked, and select OK.
i) Select DESIGN→Header/Footer→Title. Type Products By Category

6. Change the page size and orientation.


a) Switch to Print Preview.
b) Select PRINT PREVIEW→Page Size→Size→Executive.
c) In the Page Layout group, select Landscape.

d) Page through the report.


e) Select PRINT PREVIEW→Close Print Preview.

7. Save the report.


a) Save the report as rptProductsByCategory and close it.

Lesson 5: Advanced Reporting | Topic B


94 | Microsoft® Office Access® 2013: Part 2

TOPIC C
Include Control Formatting in a Report
Using control formatting and depicting data graphically can be easier to understand. In this topic,
you will add data bars to a report. This will help you tell the story of your data with a quick glance.

Data Bars
Data Bars Data bars visually display comparative data. You can apply data bars to controls in reports when the
control is bound to a numeric field. The length of a data bar represents the value in the field—
higher values generate longer bars and lower values generate smaller bars. You can specify
conditions and preview the data bar format before it is applied.

Figure 5-8: Data bars displayed for the values in the Amount column.

The Chart control has


been removed from
Access 2013. Microsoft Access the Checklist tile on your LogicalCHOICE course screen for reference
encourages users to use information and job aids on How to Include Data Bars in a Report
Microsoft Excel for all
charts because it can do
it better than Access
could.

Lesson 5: Advanced Reporting | Topic C


Microsoft® Office Access® 2013: Part 2 | 95

ACTIVITY 5-3
Adding Data Bars to a Report

Before You Begin


My CheeseEmporium_5.accdb is open.

Scenario
You want to visually highlight data in the rptInvoicesBySalesType report created earlier.

1. Add data bars to the rptInvoicesBySalesType report.


a) Open rptInvoicesBySalesType in Layout view.
b) Select $6.38 to select the Amount column.
c) Select FORMAT→Control Formatting→Conditional Formatting.
d) In the Conditional Formatting Rules Manager dialog box, select New Rule.
e) In the New Formatting Rule dialog box, in the Select a rule type list box, select Compare to other
records.
f) In the Edit the rule description section, in the Data Bar format settings section, verify that the Show
Bar only check box is unchecked.
g) From the Bar color drop-down list, in the Standard colors section, select Blue, which is the eighth
color in the last row, and select OK.

h) In the Conditional Formatting Rules Manager dialog box, select Apply, and then select OK.

2. Add a shape outline to the report.


a) Select Store to select the InvoiceType column.
b) Select FORMAT→Control Formatting→Shape Outline. In the Standard Colors section, select Red,
which is the second color in the last row.

3. Preview and save the report.


a) Switch to Print Preview. Observe the report.

Lesson 5: Advanced Reporting | Topic C


96 | Microsoft® Office Access® 2013: Part 2

b) Select PRINT PREVIEW→Close Print Preview.


c) Save and close the report.

Lesson 5: Advanced Reporting | Topic C


Microsoft® Office Access® 2013: Part 2 | 97

TOPIC D
Add a Calculated Field to a Report
You may want to display information that summarizes data by sections, pages, or for the entire
report. You can use a text box to perform calculations when you enter an expression. Access
computes the results based on where you place this text box (such as in the Report Header/Footer
or the Group Header/Footer). In this topic, you will insert a calculated field so you can provide
valuable information to the users of the report.

Access the Checklist tile on your LogicalCHOICE course screen for reference
information and job aids on How to Add a Calculated Field to a Report

Lesson 5: Advanced Reporting | Topic D


98 | Microsoft® Office Access® 2013: Part 2

ACTIVITY 5-4
Adding a Calculated Field to a Report

Before You Begin


My CheeseEmporium_5.accdb is open.

Scenario
Your manager is proposing a 10-percent price increase and wants to see that information added to
the rptProductsByCategory report you created earlier.

1. Create a text box control.


a) Open rptProductsByCategory in Design view.

b) Select DESIGN→Controls→Text Box.

Note: The layout of the Controls group will vary depending on the size of your
Access window. If the Text Box control is not visible, you may need to either
select the More drop-down menu and then select Text Box, or you may need
to select the Controls drop-down menu, and then select Text Box.
c) In the Detail section, click at the 6.25-inch mark on the horizontal ruler, just below the Detail band.

Note: This step will add a text box where the left side of the text box is at the
6.25-inch mark and just below the Detail band.

2. Specify the calculated value and set its properties.


a) Select DESIGN→Tools→Property Sheet.
b) Select the Data tab, click in the ControlSource box, and then type =[UnitPrice]*1.1
c) In the Property Sheet, select the Format tab, select the right side of the Text Align box, and then
select Right.
d) Select the right side of the Border Style box, and then select Transparent.
e) Select FORMAT→Number→$.
f) Close the Property Sheet.

3. Add a label and position controls.


a) Select Text52 and press the Delete key.

b) Select the calculated control, and using the left arrow, move it to the 5.5-inch mark on the horizontal
ruler.
c) While pressing Shift, select all the controls in the Detail section, release Shift, right-click one of the
selected controls, point to Align, and then select Bottom.

d) Select DESIGN→Controls→Label.

Lesson 5: Advanced Reporting | Topic D


Microsoft® Office Access® 2013: Part 2 | 99

Note: The layout of the Controls group will vary depending on the size of your
Access window. If the Label control is not visible, you may need to either
select the More drop-down menu and then select Text Box, or you may need
to select the Controls drop-down menu, and then select Label.
e) In the Page Header section, click on the 5.5-inch mark on the horizontal ruler, just below the Page
Header band, and type Proposed Increase
f) Select all the controls in the Page Header section and align on the top.

4. Preview and save the report.


a) Switch to Print Preview.

b) Select PRINT PREVIEW→Close Print Preview.


c) Save and close the report.

Note: For details on the new calculated field feature in Access 2013, see the
LearnTO Create a Calculated Field in a Table presentation from the LearnTO tile You may want to show
on your LogicalCHOICE Course screen. LearnTO Create a
Calculated Field in a
Table from the
LogicalCHOICE Course
screen or have students
navigate out to the
Course screen and
watch it themselves as a
supplement to your
instruction. If not, please
remind students to visit
the LearnTOs for this
course on their
LogicalCHOICE Course
screen after class for
supplemental
information and
additional resources.

Lesson 5: Advanced Reporting | Topic D


100 | Microsoft® Office Access® 2013: Part 2

TOPIC E
Add a Subreport to an Existing Report
You may want to view information from different tables, queries, and reports on the same report. In
this topic, you will add a subreport to an existing report to display the linked information in a
logical, readable way.

Subreports
A subreport is a report embedded within a main report. A main report that is bound has related tables
and queries, and you can put the subreport into the Detail section, Group Header/Footer, or
Report Header/Footer. It is possible to create “unbound” reports that do not display data but
simply act as containers for subreports. Subreports can display related information in the form of a
graph, datasheet, or report. A report can contain subreports that are nested up to seven levels deep.
Note: For information on adding a subform, see the LearnTO Create Subforms presentation
from the LearnTO tile on your LogicalCHOICE Course screen.

You may want to show


LearnTO Create
Subforms from the Access the Checklist tile on your LogicalCHOICE course screen for reference
LogicalCHOICE Course information and job aids on How to Add a Subreport to an Existing Report
screen or have students
navigate out to the
Course screen and
watch it themselves as a
supplement to your
instruction. If not, please
remind students to visit
the LearnTOs for this
course on their
LogicalCHOICE Course
screen after class for
supplemental
information and
additional resources.

Lesson 5: Advanced Reporting | Topic E


Microsoft® Office Access® 2013: Part 2 | 101

ACTIVITY 5-5
Adding a Subreport to an Existing Report

Before You Begin


My CheeseEmporium_5.accdb is open.

Scenario
You want to add a subreport to the rptProductsByCategory report you created earlier, showing the
suppliers for each category.

1. Add a group footer.


a) Open rptProductsByCategory in Design view.
b) Select DESIGN→Grouping & Totals→Group & Sort.
c) In the group band, select More to expand it, select the without a footer section arrow, and select with
a footer section.
d) Close the Group, Sort, and Total pane.

2. Add a subreport.

a) Select DESIGN→Controls→Subform/Subreport.

Note: The layout of the Controls group will vary depending on the size of your
Access window. If the Subreport/Subform control is not visible, you may need
to either select the More drop-down menu and then select Subreport/Subform,
or you may need to select the Controls drop-down menu, and then select
Subreport/Subform.
b) Position the + portion of the pointer in the upper-left corner of the CategoryNo Footer section and
click.
c) If a Microsoft Access Security Notice dialog box appears, select Open to open the wizard.
d) In the SubReport Wizard, under the What data would you like to use for your subform or subreport?
section, verify that Use existing Tables and Queries is selected, and select Next.
e) On the Which fields would you like to include on the subform or subreport? page, from the Tables/
Queries drop-down list, select Table: tblSuppliers. From the Available Fields list box, add
CategoryNo, Company, and Phone, in that order. Select Next.
f) On the Would you like to define which fields link your main form to this subform yourself, or choose
from the list below? page, verify that Show tblSuppliers for each record in qryProductCategory using
CategoryNo is shown, and select Next.
g) On the What name would you like for your subform or subreport? page, type Suppliers and select
Finish.
h) In the CategoryNo Footer section, the subreport is selected. Select a different section of the report Dragging the subreport
to deselect the subreport. In the CategoryNo Footer section, select the upper-left corner of the and hidden label so that
subreport and drag it down to expose the label beneath it. Select the Suppliers label and delete it. the learners can see the
Drag the subreport back to the upper left of the CategoryNo Footer section. label can be tricky.
Provide some guidance
or even do a specific
demonstration of this to
show them how it is
done.

Lesson 5: Advanced Reporting | Topic E


102 | Microsoft® Office Access® 2013: Part 2

Note: When the subreport is added, a label with the report name is also added
but it is either entirely covered or partially covered by the subreport. To keep
the report looking clean, you want to expose this label and delete it. When
clicking and dragging the subreport in this step you may instead drag the
label. If this happens, then just repeat the step and drag the subreport enough
to expose the label.
i) Select DESIGN→Tools→Property Sheet.
j) Select the Format tab, select the right side of the Border Style box, and then select Transparent.

3. Preview and save the report.


a) Switch to Print Preview.

b) Select PRINT PREVIEW→Close Print Preview.

Lesson 5: Advanced Reporting | Topic E


Microsoft® Office Access® 2013: Part 2 | 103

c) Save and close the report.


d) Close the database and Access.

Lesson 5: Advanced Reporting | Topic E


104 | Microsoft® Office Access® 2013: Part 2

Summary
In this lesson, you customized reports to present information in the most effective format. This
makes it easier for the reader to find information.
How might you improve your existing reports?
A: Answers will vary, but might include enhancing formatting, or adding data bars and subreports.

In what situations might you use subreports?


A: Answers will vary, but common tasks will probably be to see customer data and information about
customer orders at the same time, to track sales by employee, and view inventory.

Note: Check your LogicalCHOICE Course screen for opportunities to interact with your
classmates, peers, and the larger LogicalCHOICE online community about the topics covered in
this course or other topics you are interested in. From the Course screen you can also access
available resources for a more continuous learning experience.

Encourage students to
use the social
networking tools
provided on the
LogicalCHOICE Home
screen to follow up with
their peers after the
course is completed for
further discussion and
resources to support
continued learning.

Lesson 5: Advanced Reporting |


Microsoft® Office Access® 2013: Part 2 | 105

Course Follow-Up
In this course, you expanded your solid foundation of basic skills to an intermediate level by creating
and working with various Access objects, relationships, tables, queries, and reports. You discovered
how to maintain consistent data, customize database components, and share data with other
applications.

What's Next?
Microsoft® Office Access® 2013: Part 3 is the next course in this series. You will work with additional
features such as advanced form design, macros, and managing the Access environment.
You are encouraged to explore Access further by actively participating in any of the social media
forums set up by your instructor or training administrator through the Social Media tile on the
LogicalCHOICE Course screen.

Course Follow up
A Additional Reporting
Options
Appendix Introduction
Some additional features are available to customize reports. In this appendix, you will
examine how to generate mailing labels from a database as well as how to create a report
that can be viewed without opening the Microsoft Access database in which it resides.
108 | Microsoft® Office Access® 2013: Part 2

TOPIC A
Create a Mailing Label Report
If you want to mail materials to your customers, for instance, you can print address labels directly
from Access. In this topic, you will learn to create a mailing label report by using information from a
table, query, form, or report that contains the data you want on your labels. You are not just limited
to mailing labels. You can easily create name badges, divider tabs, product stickers, as well as many
other label types.

The Label Wizard


The Label Wizard provides templates for many different types of standard labels, identified by a
label manufacturer's name and product number. You can also create your own custom label formats.
The wizard lets you design the layout of the label, which is actually the Detail section of the report,
and then copies it across and down.

Column Layout
If you view multiple-column labels in Report view or Layout view, Access displays all the data in a
single column. Print Preview displays the columns as laid out.

Appendix A : Additional Reporting Options | Topic A


Microsoft® Office Access® 2013: Part 2 | 109

Create a Mailing Label Report


Follow these steps to create a variety of label types.

Create a Mailing Label Report


To create a mailing label report:
1. In the Navigation pane of an open Access database, select the record source for the labels.
2. Select CREATE→Reports→Labels.
3. If Access displays a security notice, select Open.
4. In the Label Wizard, in the What label size would you like? section, specify a label size.
• Specify a predefined label size.
1. From the Filter by manufacturer drop-down list, select a label manufacturer.
2. In the What label size would you like? list box, select the desired product number.
• Create a custom label size.
1. Select Customize.
2. In the New Label Size dialog box, select New.
3. In the New Label dialog box, specify the dimensions as desired and select OK.
4. In the New Label Size dialog box, select Close.
5. Select Next.
6. On the What font and color would you like your text to be? page, set the text style for the
label and select Next.
7. On the What would you like on your mailing label? page, in the Prototype Label box,
arrange the fields to create a label layout.
a. Double-click a field to move it to the Prototype Label box.
b. In the Prototype Label, type the desired text.
c. Add additional fields, if needed.
d. Add desired spacing and punctuation, and press Enter as necessary.

Appendix A : Additional Reporting Options | Topic A


110 | Microsoft® Office Access® 2013: Part 2

8. Select Next.
9. On the Which fields would you like to sort by? page, select the optional sort criteria and select
Next.
10. On the What name would you like for your report? page, name the report and select Finish.
11. If Access displays a message that there is not enough horizontal space, select OK.

Change the Layout of the Mailing Label Report


To change a multiple-column report from the "across, then down" layout to the "down, then
across" layout (also known as snaking columns):
1. Switch to Design view.
2. Select PAGE SETUP→Page Layout→Page Setup.
3. Select the Columns tab, and in the Column Layout section, select the Down, then Across
option, and select OK.

Appendix A : Additional Reporting Options | Topic A


Microsoft® Office Access® 2013: Part 2 | 111

TOPIC B
Publish a Report as a PDF
If you want to distribute an Access report electronically, you can export the report as a Portable
Document Format (PDF) file. In this topic, you will learn to publish a report as a PDF. This
preserves the layout and formatting of the original report. The recipient will need a free PDF reader,
such as Adobe Reader, to open the file.

Publish a Report as a PDF


Use this technique to quickly and easily create PDF files.

Save a Report as a PDF


To save a report as a PDF:
1. Open the report in Access.
2. Select EXTERNAL DATA→Export→PDF or XPS.
3. In the Publish as PDF or XPS dialog box, in the File name text box, enter the name for the
file.
4. In the Save as type drop-down list, verify that the PDF option is selected.
5. Select Options to select the number of pages to be published as PDF.
6. Select Publish.

Appendix A : Additional Reporting Options | Topic B


B Microsoft Office Access
2013 Exam 77-424
Selected Logical Operations courseware addresses Microsoft Office Specialist (MOS)
certification skills for Microsoft Office 2013. The following table indicates where Access
2013 skills that are tested on Exam 77-424 are covered in the Logical Operations Microsoft
Office Access 2013 series of courses.

Objective Domain Covered In

1. Create and Manage a Database


1.1. Create a New Database
1.1.1. Create New Databases Part 1
1.1.2. Create Databases Use Templates Part 1
1.1.3. Create Databases in Older Formats Part 1
1.1.4. Create Databases Use Wizards Part 1
1.2. Manage Relationships and Keys
1.2.1. Edit References Between Tables Part 2, Topic 1-A
1.2.2. Create and Modify Relationships Part 2, Topic 1-C
1.2.3. Set Primary Key Fields Part 1
1.2.4. Enforce Referential Integrity Part 2, Topic 1-C
1.2.5. Set Foreign Keys Part 2, Topic 1-A
1.2.6. View Relationships Part 2, Topic 1-C
1.3. Navigate Through a Database
1.3.1. Navigate to Specific Records Part 1
1.3.2. Set a Form as the Startup Option Part 3
1.3.3. Use Navigation Forms Part 3
1.3.4. Set Navigation Options Part 3
1.3.5. Change Views Part 1; Part 3
1.4. Protect and Maintain a Database
1.4.1. Compact Databases Part 3
1.4.2. Repair Databases Part 3
1.4.3. Backup Databases Part 3
114 | Microsoft® Office Access® 2013: Part 2

Objective Domain Covered In


1.4.4. Split Databases Part 3
1.4.5. Encrypt Databases with a Password Part 3
1.4.6. Merge Databases Part 2, Topic 2-A
1.4.7. Recover Data From a Backup Part 3
1.5. Print and Export a Database
1.5.1. Print Reports Part 1
1.5.2. Print Records Part 1
1.5.3. Maintain Backward Compatibility Part 1
1.5.4. Save Databases as Templates Part 3
1.5.5. Save Databases to External Locations Part 2, Topics 4-B, 4-C
1.5.6. Export to Alternate Formats Part 2, Topics 4-B, 4-C
2. Build Tables
2.1. Create a Table
2.1.1. Create New Tables Part 1
2.2.1. Import External Data Into Tables Part 3
2.1.2. Create Linked Tables from External Sources Part 3
2.1.3. Import Tables from Other Databases Part 2, Topic 4-A
2.1.4. Create Tables from Templates and Application Parts Part 1; Part 3
2.1.5. Freeze or Unfreeze fields Part 1
2.2. Format a Table
2.2.1. Hide Fields in Tables Part 1
2.2.2. Change Data Formats Part 1
2.2.3. Add Total Rows Part 1
2.2.4. Add Table Descriptions Part 2, Topic 1-B
2.2.5. Rename Tables Part 1
2.3. Manage Records
2.3.1. Update Records Part 1
2.3.2. Add New Records Part 1
2.3.3. Delete Records Part 1
2.3.4. Append Records from External Data Part 2, Topic 4-A
2.3.5. Find and Replace Data Part 1
2.3.6. Sort Records Part 1
2.3.7. Filter Records Part 1
2.3.8. Group Records Part 1
2.4. Create and Modify Fields
2.4.1. Add Fields to Tables Part 1

Appendix B : Microsoft Office Access 2013 Exam 77-424 |


Microsoft® Office Access® 2013: Part 2 | 115

Objective Domain Covered In


2.4.2. Add Validation Rules to Fields Part 3
2.4.3. Change Field Captions Part 2, Topic 1-B
2.4.4. Change Field Sizes Part 2, Topic 1-B
2.4.5. Change Field Data Types Part 1
2.4.6. Configure Fields to Auto-Increment Part 1
2.4.7. Set Default Values Part 2, Topic 1-B
2.4.8. Use Input Masks Part 2, Topic 1-B
2.4.9. Delete Fields Part 1
3. Create Queries
3.1. Create a Query
3.1.1. Run Queries Part 1
3.1.2. Create Crosstab Queries Part 1
3.1.3. Create Parameter Queries Part 1
3.1.4. Create Action Queries Part 1
3.1.5. Create Multi-Table Queries Part 1
3.1.6. Save Queries Part 1
3.1.7. Delete Queries Part 1
3.2. Modify a Query
3.2.1. Rename Queries Part 1
3.2.2. Add New Fields Part 1
3.2.3. Remove Fields Part 1
3.2.4. Hide Fields Part 1
3.2.5. Sort Data within Queries Part 1
3.2.6. Format Fields within Queries
3.3. Utilize Calculated Fields and Grouping within a
Query
3.3.1. Add Calculated Fields Part 1
3.3.2. Add Conditional Logic Part 1
3.3.3. Group and Summarize Data Part 1
3.3.4. Use Comparison Operators Part 1
3.3.5. Use Basic Operators Part 1
4. Create Forms
4.1. Create a Form
4.1.1. Create New Forms Part 1
4.1.2. Create Forms with Application Parts Part 3
4.1.3. Save Forms Part 1
4.1.4. Delete Forms Part 1

Appendix B : Microsoft Office Access 2013 Exam 77-424 |


116 | Microsoft® Office Access® 2013: Part 2

Objective Domain Covered In


4.2. Set Form Controls
4.2.1. Move Form Controls Part 1
4.2.2. Add Form Controls Part 1
4.2.3. Modify Data Sources Part 3
4.2.4. Remove Form Controls Part 1
4.2.5. Set Form Control Properties Part 1
4.2.6. Manage Labels Part 3
4.3. Format a Form
4.3.1. Modify Tab Order in Forms Part 3
4.3.2. Format Print Layouts Part 1
4.3.3. Sort Records Part 1
4.3.4. Apply Themes Part 1
4.3.5. Change Margins Part 1
4.3.6. Insert Backgrounds Part 3
4.3.7. Auto-Order Forms Part 3
4.3.8. Insert Headers and Footers Part 1
4.3.9. Insert Images Part 3
4.3.10. Modify Existing Forms Part 3
5. Create Reports
5.1. Create a Report
5.1.1. Create new Reports Part 1
5.1.2. Create Reports with Application Parts Part 3
5.1.3. Delete Reports Part 1
5.2. Set Report Controls
5.2.1. Group Data by Fields Part 2, Topic 5-A; Part 1
5.2.2. Sort Data Part 1
5.2.3. Add Sub-Forms Part 2, Topic 5-E
5.2.4. Modify Data Sources Part 1
5.2.5. Add Report Controls Part 2, Topic 5-A
5.2.6. Manage Labels Part 1
5.3. Format a Report
5.3.1. Format Reports into Multiple Columns
5.3.2. Add Calculated Fields Part 2, Topic 5-D
5.3.3. Set Margins Part 2, Topic 5-B; Part 1
5.3.4. Add Backgrounds Part 2, Topic 5-B
5.3.5. Change Report Orientation Part 2, Topic 5-B

Appendix B : Microsoft Office Access 2013 Exam 77-424 |


Microsoft® Office Access® 2013: Part 2 | 117

Objective Domain Covered In


5.3.6. Change Sort Order Part 1
5.3.7. Insert Headers and Footers Part 1
5.3.8. Insert Images Part 1
5.3.9. Insert Page Numbers Part 2, Topic 5-A
5.3.10. Apply Themes Part 1
5.3.11. Modify Existing Reports Part 2, Topic 5-B; Part 1

Appendix B : Microsoft Office Access 2013 Exam 77-424 |


C Microsoft Access 2013
Common Keyboard
Shortcuts
The following table lists common keyboard shortcuts you can use in Access 2013.

Function Shortcut

Open a new database Ctrl + N


Open an existing database Ctrl + O
Open the Print dialog box Ctrl + P
Open the Find tab Ctrl + F
Copy the selected contents Ctrl + C
Cut the selected contents Ctrl + X
Paste the selected content Ctrl + V
Undo typing Ctrl + Z
Cycle between open windows Ctrl + F6
Check spelling F7
Rename a selected object F2
Show the access keys F10
Switch to the next tab in a dialog box Ctrl + Tab
Switch to the previous tab in a dialog box Ctrl + Shift + Tab
Move to the beginning of an entry Home
Move to the end of an entry End
Toggle the property sheet tab F4
Toggle the Field List pane Alt + F8
Insert the current data Ctrl + ;
Insert the current time Ctrl + Shift + :
Add a new record Ctrl + +
Delete the current record Ctrl + -
Save changes to the current record Shift + Enter
Lesson Labs

Lesson labs are provided for certain lessons as additional learning resources for this course.
Lesson labs are developed for selected lessons within a course in cases when they seem
most instructionally useful as well as technically feasible. In general, labs are supplemental,
optional unguided practice and may or may not be performed as part of the classroom
activities. Your instructor will consider setup requirements, classroom timing, and
instructional needs to determine which labs are appropriate for you to perform, and at what
point during the class. If you do not perform the labs in class, your instructor can tell you if
you can perform them independently as self-study, and if there are any special setup
requirements.
122 | Microsoft® Office Access® 2013: Part 2

Lesson Lab 5-1


Putting It All Together

Activity Time: 25 minutes

Data Files
C:\091005Data\Lesson Labs\LessonLabs.accdb
C:\091005Data\Lesson Labs\tblInvoices.xlsx

Scenario
The store owner would like your help to add some new data to an empty database and
generate meaningful information.

1. Open the LessonLabs database and save it as My LessonLabs

2. Create a table named tblShippers

3. Insert fields named ID, Company, Address, City, State, Zip, and Phone. Make the ID field
the primary key, and change its Data Type to AutoNumber. Leave the other data types at
their defaults.

4. Add the following records to the table:

Company Address City State Zip Phone

Standard 5348 E. Pine Des Moines IA 5030 515-555-788


Shipper Ct. 6 1
Two-Day 899 State Charleston SC 2940 843-555-232
Shipper Road 54 1 3
Expedited 34987 S. Denver CO 8024 303-555-245
Shipper Tulip Lane 1 7

5. Close the table.

6. Import tblInvoices.xlsx into a new table in your database. Make InvoiceNo the primary
key. Do not save the import steps.

7. Create a query join between the two tables in your database on the Shipping ID field.
(Note: The field names are not identical in each table.) Add the InvoiceNo, Amount, ID,
Company, and Shipping Fees fields to the design grid in that order. Run the query. Save
the query as qryShipped

8. Edit the query to be a left outer join. Run the query to see the results. Save the query as
qryAll and then close the query.

9. Create and save a permanent relationship on the Shipping ID field between the two
tables. Do not enforce referential integrity.

Lesson Labs
Microsoft® Office Access® 2013: Part 2 | 123

10. Insert tblInvoices into tblShippers as a subdatasheet, if Access does not do it automatically. Expand the
subdatasheet to the left of ID 2. Change the amount of the first record from $21.98 to $26.98, collapse
the subdatasheet, and close the table.

11. Create a tabular report named rptTotals from tblInvoices showing all fields (Hint: Select the desired
table and select Report). Use the Group, Sort, and Total pane to group by CustomerID and sort by
InvoiceNo. You would like to start a new page at each change in group value. Switch to Landscape
orientation. Adjust the width of the columns. Add a calculated field (adding the Amount to the Shipping
Fees formatted as currency) to the Detail section with the label named Total to the Page Header
section. Align the controls on the top. Set the Border Style to transparent. Remove the alternate row
color. Delete the page number in the Page Footer section and collapse it. Delete the date and time
controls in the Report Header. Make any other formatting changes you wish.

12. Close any open objects.

13. Close the database.

Lesson Labs
Solutions

ACTIVITY 1-1: Analyzing the Relational Database Design


Process

1. Which statement about relational databases is false?


○  Fields are columns of data.
◉  Information is stored in a single table.
○  Redundant data wastes space.
○  Rows contain items related to one entity.
2. True or false? Paper forms are an example of existing data.
◉  True
○  False
3. True or false? It does not matter whether or not you break data into its smallest logical parts.
○  True
◉  False
4. Which is the term for the field in a table that contains unique information for each record?
○  Foreign key
○  Composite key
◉  Primary key
5. True or false? A real-world example of a one-to-many relationship would be a manager
overseeing zero or more employees, while an employee has one manager.
◉  True
○  False
Glossary

business rules exporting data


Policies and procedures that dictate how a The process used to send out a copy of
business does business. data from one application to another.

composite key field


Two or more fields that function as the A column in a table containing a single
primary key. piece of information.

data bars first normal form (1NF)


A way to visually display comparative data. Each cell of a table must contain a single
value and the table must not contain
data type repeating groups.
The field property that determines what
data value you can store. Force New Page property
Used to print a new page every time the
Datasheet view group value changes.
Displays fields in columns and records in
rows similar to a table or spreadsheet. foreign key
Another table's primary key.
delimiters
Single characters used to separate fields of Get External Data wizard
data from each other. The feature that starts when you choose an
option from the Import & Link group.
denormalization
Selectively adding redundant data back to a Group, Sort, and Total pane
normalized table to speed up data retrieval. Allows you to select sort fields and
grouping fields for a report.
Design view
Displays the underlying structure of the importing data
table's fields, but does not display the data The process used to bring in a copy of data
stored in the table. from an external source.

Edit Relationships dialog box inner join


Enables you to change a table relationship. Shows only the records that have matching
values in the joined field in both tables.
existing data
Information an organization already join line
gathers. Connects the common field used to create
the relationship between two tables.
128 | Microsoft® Office Access® 2013: Part 2

Join Properties dialog box query join


Enables you specify how two tables are to Similar to a relationship but is temporary.
be joined.
record
junction table A row in a table consisting of data
Used to create a many-to-many pertaining to one entity.
relationship between two tables.
referential integrity
Keep Together property A set of rules Access uses to preserve the
Used to keep parts of the group together defined relationships between tables when
on the same page. data is updated.

left outer join relational database


Returns all records from the primary table Organizes data into related tables stored in
and only matching records from the the same file.
foreign table.
relationship
many-to-many relationship An association between common fields in
For every record in the first table, there two tables.
can be many records in the second table;
and for every record in the second table, relationship report
there can be many records in the first table. A display of the map of how your database
tables are related, as shown in the
Microsoft Word Mail Merge Wizard Relationships window.
Allows you to create a direct link between
an Access table or query and a Word Relationships window
document. Graphically displays the tables in a
database, the fields in each table, and the
normalization relationships between those tables.
The design process of simplifying table
structure. report control properties
Allow you to customize a control's settings
one-to-many relationship on the Property Sheet.
For every record in the first table, there
can be zero, one, or many records in the rich text property
second table; but for every record in the Allows you to single out an entry with
second table, there is exactly one record in different formatting such as bold,
the first table. underline, and indentation.

one-to-one relationship right outer join


For every record in the first table, there is a Returns all records from the foreign table
matching record in the second table. and only matching records from the
primary table.
outer join
Shows all the records from one table and second normal form (2NF)
only those records from the other table Should satisfy the first form, and each field
that have matching values from the first must depend on the entire primary key.
table.
self join
primary key A join that relates data in a table to itself.
Uniquely identifies each record in a table.

Glossary
Microsoft® Office Access® 2013: Part 2 | 129

statement of purpose
A written statement defining the objectives
of the database.

subdatasheet
A datasheet within another datasheet.

subquery
A SELECT statement within a SELECT
statement.

subreport
A report embedded within a main report.

table
A structure that organizes data in columns and
rows, similar to a spreadsheet.

Table Analyzer Wizard


An analysis tool that scans a table's structure
for duplicate data.

third normal form (3NF)


Should satisfy the first and second forms, and
each field must depend only on the single-field
primary key.

Glossary
Index

1NF 48 E
2NF 48 Edit Relationships dialog box 21
3NF 49 Enforce Referential Integrity option 21
existing data 3
A exporting data
Alias property 36 to Excel 70
Attachment data type 12
F
B Field List pane 83
business rules 4 fields
determining 3
grouping into tables 4
C first normal form, See 1NF
Calculated Field data type 12 footers in a report 82
calendar 12 Force New Page property 90
Cascade Delete Related Records option 21
Cascade Update Related Fields option 21 G
composite keys 6
Currency data type 11 Get External Data wizard 62

D H
data headers in a report 82
bars 94 Hyperlink data type 12
types 10
Datasheet view 10 I
Date & Time data type 11 importing data 62
Date Picker 12 inner join 28
delimiters 63
denormalization 50
designing relational databases 2
J
Design view 10 join line 22
Join Properties dialog box 30
junction table 53
132 | Microsoft® Office Access® 2013: Part 2

K design tools 81
format tools 88
Keep Together property 89
Group, Sort, and Total pane 82
keys
headers and footers 82
composite 6
pagination 89
foreign 5
relationship 22
primary 5
sections 81
subreports 100
L Rich Text data type 12
left outer join 29 rich text property 88
Long Text data type 12 right outer join 30
Lookup & Relationship data type 12
Lookup Wizard 13 S
second normal form, See 2NF
M self joins 36
mail merge Short Text data type 11
merge fields 73 statement of purpose 3
Microsoft Word Mail Merge Wizard 73 subdatasheet 39
Mail Merge task pane 74 subqueries 42
many-to-many relationships 53 subreports 100
switching between table views 10
N
T
Number data type 11
Table Analyzer Wizard 51
Table Properties dialog box 14
O table relationships
one-to-many relationships 7 many-to-many 53
one-to-one relationships 7 one-to-many 7
outer join 29 one-to-one 7
tables
P composite keys 6
foreign keys 5
pagination in reports 89
improve table structure 56
primary keys 5
normalization 4
primary keys 5
Q records 4
query join 28 table views
Datasheet view 10
R Design view 10
switching 10
referential integrity third normal form, See 3NF
guidelines 21
relational databases
design process 2
Y
relationship report 22 Yes/No data type 12
Relationships window 20
reports
adding calculated field 97
control properties 89
Controls group 80

Index
091005S rev 2.2

You might also like