145
INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara Ave., Glendale, WI 53209 Phone: 800-605-4985 http://www.pcmcourseware.com EVALUATION ONLY

Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

I N S T R U C T O R - L E D C O U R S E W A R E

Access 2016 – Level 3

PCM Courseware, LLC. 6960 N. Ardara Ave., Glendale, WI 53209

Phone: 800-605-4985 http://www.pcmcourseware.com

EVALUATIO

N ONLY

Page 2: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

I N T R O D U C T I O N

Introduction 2

I N S T R U C T O R - L E D C O U R S E W A R E

Access 2016 – Level 3

PCM Courseware, LLC. 6960 N. Ardara Ave., Glendale, WI 53209

Phone: 800-605-4985 http://www.pcmcourseware.com

COPYRIGHT NOTICE AND LICENSE AGREEMENT

PCM Courseware, LLC. 2013 ALL RIGHTS RESERVED. This material is copyrighted and all rights are reserved by PCM Courseware, LLC. When you purchase this product, you are entitled unlimited use of purchased product in perpetuity.

This product may be used by instructors only at a single site unless licenses were purchased for more than one site. However, instructors at a site may teach using the courseware at several locations; that is to say, instructors based out of a licensed physical location may travel and teach using the courseware at others locations. The number of sites eligible for use of the course materials will equal the number of site licenses purchased. You may copy and distribute the manual files, lesson files and lab files only within the confines of the specific site(s) of the license agreement. You may not under any circumstances, distribute, rent, sell or lease the manual, its documentation, the training files, or any copies thereof, to third parties. If the purchaser has more than one physical training location and wishes to use the courseware at these locations (branches in different cities, for example), then a licensed must be purchased for each additional location that contains instructors.

Courseware may be customized and modified as the purchaser sees fit as long as the copyright information is clearly displayed within all documents. The purchaser may add their own name and logo to the printed manuals as long as the copyright information is present on all printed versions of the courseware.

This courseware license may not be transferred, assigned, given, rented, leased or resold to any third party in any form.

Only printed copies of the courseware may be made available to students. Under no circumstances may the source Microsoft Word courseware files be made available on a network or the Internet that is accessible by the general public.

It is the responsibility of the Purchaser to print out copies of the courseware. PCM Courseware, LLC will in no way be held responsible for inadequate printing facilities at the Purchaser’s site, resulting in the

EVALUATIO

N ONLY

Page 3: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

I N T R O D U C T I O N

inability to print out the courseware. In such cases that the original source courseware files or training files are corrupted, PCM Courseware, LLC will replace any corrupted training files.

Passwords necessary to access the courseware or download courseware from the PCM Courseware, LLC Web site must not be disclosed to any third party in any form. The purchaser may not make available any courseware to those who have not attended a training class at the purchaser’s licensed site. Under no circumstances may printed or electronic copies of our courseware be resold. If purchaser wishes to recoup their costs for copying the manuals, they may increase the price of the course to include manual copying costs. However, students may not be individually charged for the printed manuals. Manuals may not be placed for sale in any public location such as a bookstore or any other retail establishment. Passwords necessary to access the courseware or download courseware from the PCM Courseware, LLC Web site must not be disclosed to any third party in any form.

Any student who has attended a training class in which PCM Courseware training materials were used may keep one copy of the printed training manual and any accompanying exercise and lab files for personal use only.

PCM Courseware, LLC. reserves the right to revise this manual and its files and make changes from time to time in their content without notice.

This license entitles the purchaser of the Entire Courseware Library to receive any new courseware or any updates to existing courseware produced within one (1) year of the purchase date via the PCM Courseware, LLC Web site. PCM Courseware, LLC will not be held responsible for an inadequate Internet Connection at the purchaser’s location resulting in an inability of download any new courseware.

The purchaser’s remedy for problems or inconveniences encountered from the use of the training manual or its related training files shall be limited to the refund of the price paid for this courseware. PCM Courseware, LLC. shall not be liable to the purchaser or any other person with respect to any liability, loss or damage caused, directly or indirectly, by use of this courseware or the related training files. Please inform PCM Courseware, LLC of any errors or omissions in any of the courseware materials.

While every genuine effort has been made to ensure the accuracy of the material, PCM Courseware, LLC. makes no warranty, express or implied, with respect to the correctness, reliability and freedom from error of the manual or the related training files. Data used in this manual and its training files are fictitious. Any reference to actual persons or companies is entirely coincidental.

EVALUATIO

N ONLY

Page 4: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

I N T R O D U C T I O N

Introduction 4

Table of Contents

TABLE OF CONTENTS .......................................................................................................................4

ACCESS 2016 LEVEL 3 – INTRODUCTION .........................................................................................6

COURSE REQUIREMENTS ...............................................................................................................6 COMPONENTS OF THE MANUAL ....................................................................................................7 TRAINING FILES ............................................................................................................................8 WHAT’S NEW IN ACCESS 2016? ....................................................................................................9

LESSON 1 - WORKING WITH MACROS ..................................................................................... 10

1.1 CREATING A MACRO ........................................................................................................ 11 1.2 ADDING ADDITIONAL MACRO ACTIONS .......................................................................... 16 1.3 RUNNING A MACRO STEP-BY-STEP .................................................................................. 22 1.4 ASSIGNING A MACRO TO A COMMAND BUTTON .............................................................. 25 1.5 CREATING A MACRO GROUP ............................................................................................ 31 1.6 USING A MACRO GROUP .................................................................................................. 37 1.7 USING MACRO CONDITIONS ............................................................................................. 41 1.8 THE AUTOEXEC MACRO .................................................................................................. 50 1.9 CREATING AN AUTOKEYS MACRO ................................................................................... 53 1.10 CREATING A DATA MACRO ........................................................................................... 58 1.11 ADDING A MACRO TO THE QUICK ACCESS TOOLBAR ................................................... 63 LESSON 1 QUIZ ............................................................................................................................ 68 LAB 1 – ON YOUR OWN ......................................................................................................... 70

LESSON 2 - ACTION QUERIES .................................................................................................. 71

2.1 ABOUT ACTION QUERIES ................................................................................................. 72 2.2 CREATING A MAKE-TABLE QUERY .................................................................................. 73 2.3 CREATING AN APPEND QUERY ......................................................................................... 80 2.4 CREATING AN UPDATE QUERY ......................................................................................... 85 2.5 CREATING A DELETE QUERY ........................................................................................... 89 2.6 CREATING A SQL QUERY ................................................................................................. 93 LESSON SUMMARY – ACTION QUERIES ....................................................................................... 97 LESSON 2 QUIZ ............................................................................................................................ 98 LAB 2 – ON YOUR OWN ....................................................................................................... 100

LESSON 3 - IMPORTING AND EXPORTING DATA ................................................................... 101

3.1 IMPORTING DATA FROM A TEXT FILE............................................................................. 102 3.2 IMPORTING DATA FROM EXCEL ..................................................................................... 108 3.3 IMPORTING DATA FROM ANOTHER ACCESS DATABASE ................................................. 112 3.4 LINKING DATA ............................................................................................................... 115 3.5 EXPORTING DATA TO OTHER FORMATS ......................................................................... 119 3.6 EXPORTING DATA TO A PDF FILE .................................................................................. 122 3.7 EXPORTING DATA TO ANOTHER ACCESS DATABASE .................................................... 125 3.8 EXPORTING DATA TO EXCEL .......................................................................................... 128 3.9 EXPORTING DATA TO MICROSOFT WORD ...................................................................... 131 3.10 EXPORTING DATA TO A MICROSOFT WORD MAIL MERGE .......................................... 135 LESSON SUMMARY – IMPORTING AND EXPORTING DATA ......................................................... 140 LESSON 3 QUIZ .......................................................................................................................... 142

EVALUATIO

N ONLY

Page 5: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

I N T R O D U C T I O N

LAB 3 – ON YOUR OWN ....................................................................................................... 144

LESSON 4 - CREATING A MENU SYSTEM ............................................................................... 145

4.1 CREATING A SWITCHBOARD ........................................................................................... 146 4.2 ADDING SWITCHBOARD ITEMS ....................................................................................... 151 4.3 USING THE SWITCHBOARD ............................................................................................. 154 4.4 EDITING A SWITCHBOARD .............................................................................................. 157 4.5 SETTING STARTUP OPTIONS ........................................................................................... 161 4.6 CREATING A NAVIGATION FORM ................................................................................... 165 LESSON SUMMARY – CREATING A MENU SYSTEM .................................................................... 172 LESSON 4 QUIZ .......................................................................................................................... 173 LAB 4 – ON YOUR OWN ....................................................................................................... 174

LESSON 5 - WORKING WITH FORMS AND REPORTS.............................................................. 176

5.1 ADDING A SUBFORM USING THE SUBFORM/SUBREPORT TOOL ....................................... 177 5.2 MODIFYING A SUBFORM ................................................................................................ 183 5.3 ALIGNING CONTROLS TO EACH OTHER .......................................................................... 188 5.4 CREATING AN OPTION GROUP ........................................................................................ 192 5.5 EDIT SORTING AND GROUPING LEVELS IN A REPORT ..................................................... 199 5.6 INSERTING TOTAL FIELDS IN A REPORT ......................................................................... 205 5.7 USING RECTANGLES, LINES AND BORDERS .................................................................... 209 LESSON SUMMARY – WORKING WITH FORMS AND REPORTS .................................................... 215 LESSON 5 QUIZ .......................................................................................................................... 217 LAB 5 – ON YOUR OWN ....................................................................................................... 219

LESSON 6 - DATABASE TOOLS AND MAINTENANCE .............................................................. 220

6.1 USING COMPACT AND REPAIR ........................................................................................ 221 6.2 CHANGING DATABASE PROPERTIES ............................................................................... 223 6.3 DOCUMENTING A DATABASE ......................................................................................... 226 6.4 ANALYZING A DATABASE .............................................................................................. 229 6.5 VIEWING OBJECT DEPENDENCIES .................................................................................. 232 6.6 BACKING UP A DATABASE .............................................................................................. 236 6.7 SPLITTING A DATABASE ................................................................................................. 239 6.8 SETTING A DATABASE PASSWORD ................................................................................. 241 LESSON SUMMARY – DATABASE TOOLS AND MAINTENANCE ................................................... 245 LESSON 6 QUIZ .......................................................................................................................... 247 LAB 6 – ON YOUR OWN ....................................................................................................... 249

CLASS PROJECT – SALES DATABASE ........................................................................................... 251

INDEX ............................................................................................................................................ 253

EVALUATIO

N ONLY

Page 6: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

I N T R O D U C T I O N

Introduction 6

Access 2016 Level 3 –

Introduction

Welcome to PCM Courseware! PCM Courseware is a distinctive, flexible system for an instructor-led environment that facilitates learning via auditory, visual and hands-on experiences by each student. The manual is broken down into several lessons with each lesson subdivided into several sections. Each section covers a particular skill or concept related to the main lesson topic. In each section you will find:

1. A brief introduction to the section topic. 2. Step-by-step “how to” instructions. 3. A hands-on “Let’s Try It” exercise which students perform with the instructor. 4. An independent “On Your Own” activity at the end of each lesson to identify

any problem areas and to ensure that learning has taken place. 5. A chapter summary at the end of the lesson, reviewing major concepts and

topics discussed in the chapter. 6. Chapter quiz to ensure that learning has taken place.

Rather than having to sift through blocks of paragraphs of written text, the introductions are brief and easy to understand, illustrated with diagrams, lists, tables and screen shots to aid in comprehension and retention. The step-by-step format of the manual enables for quick scanning by the instructor during teaching time and the ability to pull out the main points quickly without having to filter the desired information from chucks of text.

Course Requirements

It is assumed that the student has a fundamental understanding of the Windows operating system and how to maneuver with a mouse. Students should be familiar with the concepts taught in the Access 2016 Level 1 and Level 2 courses.

A full installation of Microsoft Access 2016 should be available on each desktop, with a fresh installation strongly encouraged. EVALU

ATION O

NLY

Page 7: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

I N T R O D U C T I O N

Components of the Manual

The Access 2016 manual consists of the following components:

A Table of Contents To allow the students to quickly find desired concepts

Introduction Discussion of manual components, course requirements, courseware philosophy and training lab set.

Lessons The lessons are the manual chapters, each of which is composed of several sections relating to the lesson topic or skill.

Sections Each section begins with a brief introduction to the section topic and is followed by step-by-step instructions on how the student is to accomplish a particular task. The students then perform the task with the instructor in a “Let’s Do It!” exercise. Each step in the Let’s Do It exercise provides the How (step-by-step) and Why (the reason for performing the step) of each phase necessary to accomplish the task.

Lesson Summary The sections concepts are summarized in sequential order in the Lesson Summary section, allowing for quick review.

Labs Each section concludes with an independent “On Your Own” exercise called a Lab. The Lab gives the opportunity for the student to practice what he/she has learned and to discover any problem areas with the topic in the section. Each lab covers the skills taught in that particular lesson (chapter).

Chapter Summary Each section concludes with a “Chapter Summary” which briefly reviews all of the topics discussed in the section.

Chapter Quiz Each section concludes with an independent “Chapter Quiz” to test the level of learning that has taken place. The quiz is in multiple choice and short answer format and can be done in class together or as an end of chapter test.

Class Project The course concludes with an independent “Class Project” to test the level of learning that has taken place. In this project, the student utilizes skills learned throughout the class.

Index Allows students to quickly find desired concepts. EVALUATIO

N ONLY

Page 8: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

I N T R O D U C T I O N

Introduction 8

Training Files

Each PCM Courseware course comes with a set of Lesson Files and Lab Files designed to employ real-world situations and examples. The Lesson Files are designed to be used in the Let’s Do It exercises that the students perform with the instructor. The Lab Files are to be used for the On Your Own exercises at the end of each Lesson. Both the lesson files and lab files should be stored in the folder named: Lesson Files on each student’s desktop.

EVALUATIO

N ONLY

Page 9: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

I N T R O D U C T I O N

What’s New in Access 2016?

What’s New Description of Feature App-Based Focus You can create an app in Access, upload it to SharePoint where

it can then be accessed by anyone you like.

AutoComplete Control

Entering data accurately is much easier and less error prone with

the new AutoComplete control provides drop-down lists and

recommendations when you begin typing that makes entering

data easier and more accurate.

Cloud Hosting You can store your data on the cloud if you have SharePoint on 365.

Skydrive Allows you to save your database files to your Microsoft cloud account.

SQL Backend Saving a database to SharePoint will create a full SQL Server to store the data.

Templates Access 2016 includes a set of new and professionally designed templates.

Touch Mode New touch view suited especially for tablets and smartphones.

User Interface A simpler, easier to use design.

EVALUATIO

N ONLY

Page 10: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 10

Lesson 1 - Working with Macros

Lesson Topics:

1.1 Creating a Macro

1.2 Adding Additional Macro Actions

1.3 Running a Macro Step-by-Step

1.4 Assigning a Macro to a Command Button

1.5 Creating a Macro Group

1.6 Using a Macro Group

1.7 Using Macro Conditions

1.8 The AutoExec Macro

1.9 Creating an AutoKeys Macro

1.10 Creating a Data Macro

1.11 Adding a Macro to the Quick Access Toolbar

Lesson

1

EVALUATIO

N ONLY

Page 11: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 11

1.1 Creating a Macro

This lesson will guide you through the process of creating a new macro.

acros allow you to automate common tasks such as printing a report or opening a form. If you find yourself repeating common tasks over and over, you might want to consider creating a macro, especially if the task contains one or more steps.

If you have worked with Microsoft Word, PowerPoint or Excel, you may already be familiar with the concept of macros. In these applications, you create macros by recording your keystrokes, mouse clicks, and menu commands. Creating macros is a little different in Access as you do not record your macro actions but rather enter the actions and arguments directly in the Macro Designer window.

The Macro Designer window makes it easy to create macros. The Macro Designer works right inside of Access and features an IntelliSense builder – as you choose your action, boxes appear below allowing you to set your conditions and parameters.

The Action drop-down list of the Macro Designer window contains a drop-down list of macro commands available to you. You can either choose an action from the Add New Action drop-down list or choose it from the Action catalog. Actions in the Action Catalog are grouped by their function. To add an action from the Action Catalog to the macro window, either double-click the macro or click and drag it to the macro window from the Action Catalog.

Most macro actions contain Arguments. An Argument is a value that provides information to the action. For example, if you use the OpenForm macro action, the Argument would tell the action which form to open.

M

EVALUATIO

N ONLY

Page 12: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 12

To Create a Macro

1. Click the Create tab on the Ribbon. 2. Click the Macro button on the Macros & Code group on the Ribbon. 3. Click the drop-down arrow on the Add New Action drop-down list and

choose the action from the list that you want the macro to carry out Or Double-click the action you wish to use in the Action Catalog (click the plus or

minus signs to expand or collapse the Action groups) Or Drag an action from the Action Catalog to the Macro window. 4. In the lower part of the window, enter any arguments for the action, if

required. 5. To add more actions to the macro, move to the next blank Add New Action

drop-down list and repeat steps 3-5 (Access executes the macro actions in the order that they are listed in the action column).

Let’s Try It!

What Why

1. Open the Microsoft Access application.

Launches Microsoft Access and displays the Backstage view.

2. Click Open Other Files on the bottom of the left pane.

Displays the Open pane.

3. Click the Browse button in the center pane.

Displays the Open dialog box. EVALUATIO

N ONLY

Page 13: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 13

What Why

4. Click Desktop on the left side of your screen.

Displays the Desktop folder.

5. Double-click the Lesson Files folder.

Opens the Lesson Files folder and displays the files in that folder.

6. Select the Lesson 1 file and then click Open.

Opens the Lesson 1 database.

7. Click the Create tab on the Ribbon. Switches to Create tools and commands.

8. Click the Macro button on the Macros & Code group as shown below.

Displays the Macro Designer window.

9. Click Add New Action arrow as shown below and choose OpenForm.

Selects the OpenForm action and displays available arguments for the OpenForm action.

EVALUATIO

N ONLY

Page 14: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 14

What Why

10. In the Action Arguments section in the center pane, click in the Form Name box.

Displays the form list arrow. The Form Name is a macro argument.

11. Click the Form Name arrow and select frmStudentRegistration from the list as shown below.

Selects frmStudentRegistration as the action argument.

12. Click the Save icon on the Quick Access Toolbar.

Displays the Save As dialog box. Note that you must first save a macro before you are able to run it.

EVALUATIO

N ONLY

Page 15: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 15

What Why

13. Type: mcrOpenStudentRegistration and then click OK.

Enters a name for the macro and then closes the Save As box.

14. Click the Run button on the Tools group of the Design Ribbon as shown below.

Executes the macro. The frmStudentRegistration form is opened.

15. Press the Ctrl + W keystroke combination.

Closes frmStudentRegistration.

16. Press the Ctrl + W keystroke combination again.

Closes the macro window.

EVALUATIO

N ONLY

Page 16: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 16

1.2 Adding Additional Macro Actions

In this lesson, you will add additional macro actions to your macro

ike the other Access objects, the macro object has a Design view. It is in Design view where you make changes to your macro after it has been created. In the last lesson, we created a macro with a single step. Often, a macro will need to contain several steps in order to complete a specific task. For example, you might want to

have a macro open a form, maximize the form, go to a new record, and then provide an informational message to the user. Each action is listed on its own section in the Macro Designer. Macro actions are executed in the order in which they are listed.

To Add Additional Macro Actions

1. Click the Navigation Bar and then click Macros. 2. Right-click the Macro that you wish to edit and then click Design View from

the contextual menu. 3. Click the drop-down arrow on the next Add New Action drop-down list and

choose the action from the list that you want the macro to carry out Or Double-click the action you wish to use in the Action Catalog (click the plus or

minus signs to expand or collapse the Actions groups) Or Drag an action from the Action Catalog to the Macro window.

L

EVALUATIO

N ONLY

Page 17: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 17

4. In the lower part of the window, enter any arguments for the action, if required.

5. To add more actions to the macro, move to the next blank Add New Action drop-down list and repeat steps 5-7 (Access executes the macro actions in the order that they are listed in the action column).

Let’s Try It!

What Why

1. Click the Navigation Bar and then click Macros from the list.

Displays Macro objects.

2. Select the mcrStudentRegistration macro.

Selects the mcrStudentRegistration macro.

3. Right-click the macro and then click Design View from the contextual menu.

Opens the macro in Design View.

4. Click in the Search Box in the Action Catalog pane as shown bellows.

Allows us to quickly search for an Action.

EVALUATIO

N ONLY

Page 18: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 18

What Why

5. Type: Comment in the Search Box.

Displays only Actions that meet the search criteria. Notice that the Comment action is located in the Program Flow folder.

6. Double-click Comment in the Action Catalog window as shown below.

Adds the Comment action to the macro window. Comments are optional but a good way to document your program flow.

7. Type: Opens the registration form

Enters a comment for the first macro action.

8. Click Add New Action arrow. Displays the Macro Action list.

9. Type: M Jumps to macro actions beginning with the letter M.

10. Click MaximizeWindow from the action list as shown below.

Selects MaximizeWindow as the next macro action.

EVALUATIO

N ONLY

Page 19: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 19

What Why

11. Click Add New Action arrow as shown below and choose Comment from the list.

Adds the Comment as the next action.

12. Type: Maximizes the form. Enters a comment for the macro action.

13. Press Tab. Moves to the next blank macro action field.

14. Click the arrow in the Action column and type: M

Displays the Macro Action list and jumps to macro actions beginning with the letter M.

15. Scroll down and select MessageBox from the action list.

Selects Message Box as the second macro action. The MessageBox action will display an informational message box to the user.

EVALUATIO

N ONLY

Page 20: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 20

What Why

16. In the Action Arguments section in the macro window, click in the Message box and then type: To add a new student, open frmStudents as shown below.

Enters the message that the user will receive.

17. Click in the Type box and then select Information from the drop-down list as shown below.

Specifies the type of message box the user is to receive.

18. Click in the Title box and then type: Adding a New Student as shown below.

Specifies a title for the message box.

EVALUATIO

N ONLY

Page 21: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 21

What Why

19. Click Add New Action arrow and type: Go

Displays the Macro Action list and jumps to macro actions beginning with the letters Go.

20. Select GoToControl from the action list.

Selects GoToControl as the next macro action.

21. In the Control Name box type: FirstName

Enters the name of the control that will receive focus.

22. Click the Save button on the Quick Access Toolbar.

Saves the macro design changes.

23. Click the Run button. Executes the macro. Observe the message box title and message text.

24. Click OK. Closes the message box. Notice that the focus is automatically set to the First Name field.

25. Click the Close button on the form window as shown below.

Closes frmStudentRegistration.

EVALUATIO

N ONLY

Page 22: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 22

1.3 Running a Macro Step-by-Step

In this lesson, you will learn how to test a macro by running it step-by-step.

s we have seen, executing a macro causes the macro to perform all of the steps in the macro sequence at one time. If you want to ensure that the macro performs the assigned tasks in the way that you expect, you can test your macro by having it perform one step at a time and pausing after each step. This way, you can review

the results of each macro step.

To test a macro step-by-step, click the Single Step button on the contextual Design Ribbon and then run the macro. The Macro Single Step dialog box will display after each step. Click Step to continue to the next macro action.

To Run a Macro Step-by-Step

1. Right-click the Macro that you wish to edit and then click Design View from the contextual menu.

2. Click the contextual Design tab on the Ribbon. 3. Click the Single Step button on the Tools group of the Ribbon. 4. Click the Run button on the Ribbon. 5. Click the Step button to perform the first action of the macro. 6. Repeat step 4 until all macro actions have been completed. 7. To stop testing macros, click the Single Step button to deselect it.

A

EVALUATIO

N ONLY

Page 23: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 23

Let’s Try It!

What Why

1. Click the Design tab on the Ribbon.

Displays the contextual Design Ribbon.

2. Click the Single Step button on the Tools group on the Ribbon as shown below.

Sets the option to run the macro step-by-step.

3. Click the Run button on the Tools group on the Ribbon.

Displays the Macro Single Step dialog box.

4. Click the Step button as shown below.

Performs the first macro action.

5. Click the Step button. Performs the next macro action. EVALUATIO

N ONLY

Page 24: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 24

What Why

6. Click the Step button. Performs the next macro action.

7. Click OK. Closes the message box.

8. Click the Step button. Performs the last macro action and closes the Macro Single Step dialog box.

9. Click the Close button on the form window.

Closes the open form.

10. Click the Design tab on the Ribbon.

Displays the contextual Design Ribbon.

11. Click the Single Step button on the Ribbon.

Turns off the Single Step feature.

12. Press the Ctrl + W keystroke combination.

Closes the macro window.

EVALUATIO

N ONLY

Page 25: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 25

1.4 Assigning a Macro to a

Command Button

In this lesson, you will assign a macro to a command button.

acros can be assigned to controls such as Command Buttons. Command buttons are controls that you add to your form which provide you with a way of performing action(s) by simply clicking the control. To assign a macro to a Command Button, add it to the Command Button’s On Click Property.

Thus, when a user clicks the button, the macro is executed.

Properties such as the On Click, On Got Focus, and On Double Click are called Events. An event is a specific action that occurs on or with a certain object. Access can respond to a variety of events such as mouse clicks, the opening or closing of forms, or changing the focus of a control. Events are usually the result of an action by a user.

To Assign a Macro to a Command Button

1. Create the macro that you want to execute. 2. Open the form on which you wish to add a Command Button in Design

View. 3. If the Use Control Wizards button is activated, click it to deactivate it. 4. Click the Command Button control on the Controls group on the Design

Ribbon. 5. Draw the Command Button on your form until it is the desired size. 6. Select the Command Button and then click the Property Sheet button. 7. Click in the On Click property box.

M

EVALUATIO

N ONLY

Page 26: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 26

8. Click the arrow and then select the macro you want to execute when the Command button is clicked.

Let’s Try It!

What Why

1. Click the Navigation Bar and then click Forms as shown below.

Switches to Form objects.

2. Right-click frmStudents and then click Design View from the contextual menu.

Opens frmStudents in Design View.

3. Click the Design tab on the Ribbon.

Displays the contextual Design Ribbon.

4. Click the More button on the Controls group as shown below.

Displays additional options.

EVALUATIO

N ONLY

Page 27: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 27

What Why

5. If the Use Control Wizards button on the Toolbox is activated (lit), click it to deactivate it.

We will assign a macro to our Command Button manually rather than with the Control Wizard.

6. Click the Button control button on the Ribbon as shown below.

Activates the Command Button control.

EVALUATIO

N ONLY

Page 28: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 28

What Why

7. Click and draw the Command Button in the Form Header section until the button it is about 1-inch high by 1 ½ inches long, as shown below.

Draws the Command Button in the Form Header.

8. If the Property Sheet is not displayed, click the Property Sheet button on the Ribbon.

Displays the properties for the Command Button.

9. Click the All tab on top of the Property Sheet pane.

Displays all properties for the button.

10. Double-click in the Caption property box and then type: Registration Form.

Changes the text of the Command Button to “Registration Form.”

11. Scroll down until the On Click property is visible. Click in the On Click property box.

Displays the On Click property arrow.

12. Click the arrow and then select mcrOpenStudentRegistration from the macro list as shown below.

Assigns mcrOpenStudentRegistration to the On Click event of the Command Button. When the user clicks the button, this macro will execute.

EVALUATIO

N ONLY

Page 29: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 29

What Why

13. Click the Close button on the Property Sheet Pane.

Closes the Property Sheet Pane.

14. Click the Save button on the Quick Access Toolbar.

Saves our design changes.

15. Click the arrow on the View button as shown below and then click Form View.

Switches to Form View.

16. Click the Registration Form command button.

Executes the macro that we modified in the last lesson thus opening frmStudentRegistration.

17. Click OK. Closes the Message Box. EVALUATIO

N ONLY

Page 30: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 30

What Why

18. Press the Ctrl + W keystroke combination.

Closes frmStudentRegistration.

19. Press the Ctrl + W keystroke combination.

Closes frmStudents.

EVALUATIO

N ONLY

Page 31: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 31

1.5 Creating a Macro Group

In this lesson, you will create a macro group.

f you find yourself creating a large number of macros, creating macro groups can help you manage your macros more easily. A macro group is a collection of related submacros all stored together in a single macro object.

In the illustration below, the macro group, named mcrOpenForms, is made up of three related macros: OpenRegistration, OpenStudents and OpenClasses. The name next to the word Submacro identifies each separate group of macro actions and specifies the beginning of the macro. When the group is expanded, the words End Group mark the end of the macro in that group. These three macros were included in this group because each macro carries out the OpenForm action.

You can run a macro in a macro group in an event by typing the macro group name followed by a period and then the macro name. In the preceding example, to refer to the OpenStudents macro in the mcrOpenForms macro group, you would type:

mcrOpenForms.OpenStudents

I

EVALUATIO

N ONLY

Page 32: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 32

Note that the Submacro action is different than the Group action. Group actions cannot be called or executed – they mainly serve to increase readability by storing program flow in named, collapsible blocks.

To Create a Macro Group

1. Create a blank new Macro. 2. Click the Add New Action drop-down arrow and choose Submacro from the

list. Or Expand the Program Flow category in the Action Catalog window and

double-click Submacro. 3. Click in the Submacro box and type in a name for the group. This is how you

identify each individual macro. 4. Add the actions to the group you want the macro to carry out. 5. To add another macro, click anywhere outside of the group and repeat steps 2-

4. 6. When finished, click the Save button and provide a descriptive name for the

Macro Group.

Note: You cannot run a macro group (a macro containing submacros) directly from the macro window. Submacros can only be called by a RunMacro or OnError macro action.

Let’s Try It!

What Why

1. Click the Create tab on the Ribbon. Displays Create commands and tools.

2. Click the Macro button on the Ribbon.

Opens a new blank macro window.

3. Delete the word Comment that you entered in earlier in the Action Catalog search box.

Removes the filter in the Action Catalog.

EVALUATIO

N ONLY

Page 33: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 33

What Why

4. If necessary, expand the Program Flow category in the Action Catalog pane. Double-click Submacro in the Action Catalog window as shown below.

Adds the Submacro action to the Macro window.

5. Click in the blank box next to Submacro and then type: OpenRegistration as shown below.

Specifies the name for the first submacro.

6. Click the arrow in the Add New Action box.

Displays the Macro Action list.

7. Type: O Jumps to macro actions beginning with the letter O. EVALU

ATION O

NLY

Page 34: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 34

What Why

8. Select the OpenForm action from the list.

Selects the OpenForm action.

9. In the Action Arguments section in the center pane, click in the Form Name box.

Displays the form list arrow.

10. Click the Form Name arrow as shown below and select frmStudentRegistration from the Form Name list as shown below.

Selects frmStudentRegistration as the action argument.

11. Directly below the OpenForm box, click the arrow in the Add New Action box.

Displays the Macro Action list.

12. Type: M Jumps to macro actions beginning with the letter M.

13. Select MaximizeWindow from the action list.

Selects Maximize as the second macro action.

14. Click anywhere below the words EndSubmacro.

Sets the insertion point outside of the submacro. We are now going to create a second submacro.

15. Double-click Submacro in the Action Catalog pane.

Adds the Submacro action to the Macro window.

EVALUATIO

N ONLY

Page 35: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 35

What Why

16. Click in the blank box next to Submacro and then type: OpenStudents as shown below.

Specifies the name for the new submacro.

17. Click the arrow in the Add New Action box.

Displays the Macro Action list.

18. Type: O Jumps to macro actions beginning with the letter O.

19. Select the OpenForm action from the list.

Selects the OpenForm action.

20. In the Action Arguments section in the center pane, click in the Form Name box.

Displays the form list arrow.

21. Select frmStudents from the Form Name drop-down list.

Selects frmStudents as the action argument.

22. Click anywhere below the words EndSubmacro.

Sets the insertion point outside of the submacro. We are now going to create another submacro. EVALU

ATION O

NLY

Page 36: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 36

What Why

23. Double-click Submacro in the Action Catalog pane.

Adds a third Submacro action to the Macro window.

24. Click in the blank box next to Submacro and then type: OpenClasses.

Specifies the name for the new submacro.

25. Click the arrow in the Add New Action box.

Displays the Macro Action list.

26. Type: O Jumps to macro actions beginning with the letter O.

27. Select the OpenForm action from the list.

Selects the OpenForm action.

28. In the Action Arguments section, click in the Form Name box.

Displays the form list arrow.

29. Select frmClasses from the drop-down list.

Selects frmClasses as the action argument.

30. Click the Save button on the Quick Access Toolbar.

Displays the Save As dialog box.

31. Type: mcrOpenForms in the Save As box and then click OK.

Names the macro.

32. Press the Ctrl + W keystroke combination.

Closes the Macro Group.

EVALUATIO

N ONLY

Page 37: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 37

1.6 Using a Macro Group

In this lesson, you will use the Macro Group that you created in the last section.

nce you have created your Macro Group, you are ready to use it. You add a macro in a macro group to a control the same way you add a macro that is not part of a group. However, a macro in a macro group is displayed as the macro group name, followed by a period, and then the macro name. For example, the

OpenStudents macro in the mcrOpenForms group would display as mcrOpenForms.OpenStudents.

To Add a Macro in a Macro Group to a Command

Button

1. Open the form on which you wish to add a Command Button. 2. If the Use Control Wizards button is activated, click it to deactivate it. 3. Click the Button control on the Ribbon. 4. Draw the Command Button on your form until it is the desired size. 5. Select the Command Button and then click the Property Sheet button. 6. Click in the On Click property box. 7. Click the arrow in the On Click property box. 8. Macros in a macro group will be displayed as the group name, followed by a

period, and then the macro name. 9. Select the desired macro group.submacro from the list.

O

EVALUATIO

N ONLY

Page 38: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 38

Let’s Try It!

What Why

1. Click the Navigation Bar and then click Forms.

Displays Form objects.

2. Right-click frmStudentRegistration and then click Design View.

Opens frmStudentRegistration in Design View.

3. Click the contextual Design tab on the Ribbon.

Displays Design commands and tools.

4. Click the More button on the Controls group on the Ribbon.

Displays additional Control options.

5. If the Control Wizard button is activated (lit), click it to deactivate it.

Deactivates the Control Wizard.

6. Click the Button control on the Ribbon.

Activates the Command Button control.

7. Click and draw the Command Button in the Form Header section until the button is about 1-inch high by 1 ½ inches long, as shown below.

Draws the Command Button in the Form Header.

8. With the Command Button still selected, click the Property Sheet button.

Displays the properties for the command button.

9. Double-click in the Caption property box and then type: Add Students.

Changes the text of the Command Button to “Add Students.”

10. Click the Event tab on top of the Property box, as shown below.

Displays only Event properties of the form.

EVALUATIO

N ONLY

Page 39: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 39

What Why

11. Click in the On Click property box. Displays the On Click property arrow.

12. Click the arrow and then select mcrOpenForms.OpenStudents from the macro list as shown below.

Assigns the OpenStudents macro in the mcrOpenForms group to the On Click event of the Command Button. When the user clicks the button, only this macro will execute.

13. Click the Close button of the Property Sheet Pane.

Closes the Property Sheet Pane.

14. With the button still selected, click the Format tab on the Ribbon.

Displays formatting tools and commands. We are going to add a bit of formatting to our button.

EVALUATIO

N ONLY

Page 40: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 40

What Why

15. Click the Quick Styles icon on the Control Formatting group on the Ribbon.

Displays the Quick Styles gallery.

16. Click the blue style in the 6th column of the last row.

Applies the Intense Effect – Blue, Accent 5 style to the button.

17. Click the Save button on the Quick Access Toolbar.

Saves the design changes.

18. Click the Design tab on the Ribbon. Switches to Design commands and tools.

19. Click the arrow on the View button and then click Form View.

Switches to Form View.

20. Click the Add Students command button.

Executes the OpenStudents macro in the mcrOpenForms group.

21. Press the Ctrl + W keystroke combination.

Closes frmStudents.

22. Press the Ctrl + W keystroke combination.

Closes frmStudentRegistration.

EVALUATIO

N ONLY

Page 41: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 41

1.7 Using Macro Conditions

In this lesson, you will learn how to set a macro to run under specific conditions.

n some cases, you might want to execute an action or a series of actions in a macro only if a particular condition is true. For example, you can use a macro to validate data in a form. Using conditions, you might want to display one message in response to one set of values and another message in response to a different set of values.

To execute macro actions only when certain conditions are true, you use an If block (this replaces the Condition column in older versions of Access). When an If block is executed, Access evaluates the condition – if it is true, then Access carries out the action associated with the condition. If the condition is false, Access ignores the action and any immediately following actions for that condition.

You can evaluate more than one condition by using the Else if and Else blocks. For instance, if the first condition is false, Access moves to the Else if block and evaluates the condition there. If that condition is false, it then moves to the next Else if block (if any). If all conditions are false, then Access performs the action under the Else block.

In the condition example above, the condition references a control on a form. The syntax might at first appear strange to you although it is quite logical. This construction can also be used to reference controls on a form or on a report from queries, which can be quite useful. The syntax is broken down as follows:

I

EVALUATIO

N ONLY

Page 42: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 42

[Forms]![frmEmployees]![State]

Database

Object

Form

Name

Control

Name

[Forms]![frmEmployees]![State]

Database

Object

Form

Name

Control

Name

To Use Macro Conditions

1. Create a blank new Macro. 2. Click the Add New Action drop-down arrow and choose If from the list. Or Expand the Program Flow category in the Action Catalog window and

double-click If. 3. In the Conditional Expression box, type the conditional expression Or Use the Expression Builder to create a conditional expression. 4. Add the actions you want the macro to carry out if the condition is true. 5. To test for more than one condition, click the Add Else If link. 6. In the Conditional Expression box in the Else If box, type the conditional

expression (or use the Expression builder to create the expression). 7. Repeat steps 5 & 6 for any additional conditions you wish to test for. 8. Repeat steps 3 and 4 for any other conditions you want to include in the

macro. 9. To add an action that is to be executed if all conditions evaluate to false, click

the Add Else link and then choose the action to be executed.

Let’s Try It!

What Why

1. Click the Create tab on the Ribbon.

Switches to Create commands and tools.

2. Click the Macro button on the Ribbon.

Opens a blank new Macro window.

3. Click the Add New Action drop-down arrow and then choose If from the list.

Adds the If action to the Macro window. EVALUATIO

N ONLY

Page 43: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 43

What Why

4. Click the Builder Button to the right of the If box as shown below.

Launches the Expression Builder.

5. Click the plus sign (+) next to Lesson 1.accdb as shown below.

Displays the objects in the database.

Click the plus sign (+)

next to Lesson 1.accdb

6. Click the plus sign (+) to the left of Forms as shown below.

Expands the Forms folder.

Click the plus sign

(+) next to Forms

EVALUATIO

N ONLY

Page 44: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 44

What Why

7. Click the plus sign (+) to the left of All Forms.

Expands the All Forms folder.

8. Click on frmStudentRegistation as shown below.

Expands the frmStudentRegistration folder.

Click

frmStudentRegistration

Objects in the

frmStudentRegistration

form

9. Double-click the State field in the middle window as shown below.

Adds the field reference to the Expression Window.

Double-click the

State field

Adds the field

reference to the

window

10. Type: = “MI” Completes the expression. The condition the macro will test for is whether the State field in the frmStudentRegistration form is equal to “MI.”

11. Click OK. Closes the Expression Builder window. EVALU

ATION O

NLY

Page 45: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 45

What Why

12. Click the arrow in the Add New Action box (directly underneath the If line).

Displays the Macro Action list.

13. Type: M Jumps to macro actions beginning with the letter M.

14. Select MessageBox from the list. Selects MessageBox as the macro action.

15. In the Action Arguments section, click in the Message box and then type: Michigan students do not pay an out of state fee.

Enters the message that the user will receive if the condition is true, that is to say, if the State field on frmStudentRegistration is equal to “MI.”

16. Click in the Type box and then select Information from the drop-down list.

Specifies the type of message box the user it is to receive.

17. Click in the Title box and then type: Out of State Fee

Specifies a title for the message box.

18. Click the Add Else If link as shown below.

Adds an Else If block. Conditions in this block will only execute is the condition is true and the preceding If block is not.

EVALUATIO

N ONLY

Page 46: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 46

What Why

19. Press the Shift + F2 keystroke combination.

Displays the Zoom window, making it easier to type in our expression. This time, we will type in the condition manually rather than use the builder.

20. Type: [Forms]![frmStudentRegistration]![State]="WI"

Enters the next condition. The only difference between this condition and the last one is that the evaluator is “WI” for this condition.

21. Click OK. Closes the Zoom window.

22. Click the arrow in the Add New Action box (directly under the Else If line).

Displays the Macro Action list.

23. Type: M Jumps to Macro Actions beginning with the letter M.

24. Select MessageBox from the list. Selects MessageBox as the Macro Action.

25. In the Action Arguments section, click in the Message box and then type: Wisconsin students do not pay an out of state fee.

Enters the message that the user will receive if the condition is true, that is to say, if the State field on the frmStudentRegistration form is equal to “WI.”

26. Click in the Type box and then select Information from the drop-down.

Specifies the type of message box the user it is to receive.

27. Click in the Title box and type: Out of State Fee

Specifies a title for the message box.

28. Click the Save button on the Quick Access Toolbar.

Displays the Save As dialog box. EVALUATIO

N ONLY

Page 47: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 47

What Why

29. Type: mcrOut_of_State in the Macro Name as shown below.

Provides a name for the macro.

30. Click OK. Closes the Save As dialog box.

31. Press the Ctrl + W keystroke combination.

Closes the Macro window.

32. Click the Navigation Bar and then click Forms.

Displays Form objects.

33. Right-click frmStudentRegistration and then click Design View.

Opens frmStudentRegistration in Design view.

34. Select the State text box as shown below and then click the Property Sheet button on the Design tab of the Ribbon.

Displays the properties for the State text box.

EVALUATIO

N ONLY

Page 48: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 48

What Why

35. Click the Event tab in the Property Sheet pane.

Displays only Event properties

36. Click in the On Lost Focus property box.

Activates the On Lost Focus box and displays the drop-down arrow.

37. Click the arrow and then choose mcrOut_of_State from the drop-down list as shown below.

Selects the macro to be executed when the State text box loses focus. That is to say, when your cursor moves off of the State text box.

EVALUATIO

N ONLY

Page 49: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 49

What Why

38. Click the Close button on the Property Sheet pane.

Closes the Property Sheet pane.

39. Click the arrow on the View button and click Form View.

Switches to Form view.

40. Click in the State field and then press the Tab key.

As we leave the State field, we receive the Message Box that we specified in the macro if the State was equal to “MI”.

41. Click OK. Closes the Message Box.

42. Click the Next Record button on the bottom of the main form.

Moves to the next record.

43. Click in the State field and then press the Tab key.

We do not receive a Message Box as the value in the State field does not meet either of the two conditions as specified in the macro.

44. Click the Next Record button on the bottom of the main form

Moves to the third record.

45. Click in the State field then press the Tab key.

As we leave the State field, we receive the Message Box that we specified in the macro if the State was equal to “WI”.

46. Click OK. Closes the Message Box.

47. Click the Form’s Close button. Click Yes when asked to save your changes.

Closes the Form.

EVALUATIO

N ONLY

Page 50: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 50

1.8 The AutoExec Macro

In this lesson, you will learn how to create a macro that automatically executes when the database is opened.

n AutoExec macro is a macro that automatically executes when you open a database. For instance, you may wish to display a particular form when the database is opened or perhaps display an informational message to your user. To create an AutoExec macro, create a macro as you would any other but name it:

Autoexec.

Note that an AutoExec macro runs after the Startup Options (which will be discussed in a later lesson) have taken effect; therefore, you should avoid any actions in your AutoExec macro that will change the effect of the Startup Option settings.

To Create an AutoExec Macro

1. Click the Create tab on the Ribbon. 2. Click the Macro button on the Macros & Code group on the Ribbon. 3. Click the drop-down arrow on the Add New Action drop-down list and

choose the action from the list that you want the macro to carry out Or Double-click the action you wish to use in the Action Catalog (click the plus or

minus signs to expand or collapse the Actions groups) Or Drag an action from the Action Catalog to the Macro window. 4. In the lower part of the window, enter any arguments for the action, if

required. 5. To add more actions to the macro, move to the next blank Add New Action

drop-down list and repeat steps 3-5 (Access executes the macro actions in the order that they are listed in the action column).

A

EVALUATIO

N ONLY

Page 51: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 51

6. Click the Save button and then name your macro AutoExec. Make sure that any actions in your AutoExec macro do not change the effect of the startup option settings.

Let’s Try It!

What Why

1. Click the Create tab on the Ribbon.

Switches Create commands and tools.

2. Click the Macro button on the Ribbon.

Opens a blank new Macro window.

3. Click the arrow in the Add New Action box and then type: O

Jumps to macro actions beginning with the letter O.

4. Select the OpenForm action. Selects the macro action.

5. In the Action Arguments section in the lower part of the window, click in the Form Name box.

Displays the form list arrow. The Form Name is a macro argument.

6. Select frmStudentRegistration from the Form Name list.

Selects frmStudentRegistration as the action argument.

7. Click the arrow in the next blank Add New Action box.

Displays the Macro Action list.

8. Type: M Jumps to macro actions beginning with the letter M.

9. Select MaximizeWindow from the action list.

Selects Maximize as the second macro action.

10. Click the Save button on the Quick Access Toolbar.

Displays the Save As dialog box.

11. Type: AutoExec in the Macro Name box as shown below.

Specifies a name for our macro. EVALUATIO

N ONLY

Page 52: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 52

What Why

12. Click OK. Closes the Save As box.

13. Press the Ctrl + W keystroke combination.

Closes the Macro window.

14. Click the File tab on the Ribbon and then click Close from the File Options pane.

Closes the database. We are going to reopen the database to test our AutoExec macro.

15. Press the Ctrl + O keystroke combination.

Displays the Open pane.

16. Click the Lesson 1 database under the Today area in the right pane.

Opens the Lesson 1 database. The Student Registration form automatically opens and then is maximized as specified in our AutoExec macro.

17. Press the Ctrl + W keystroke combination.

Closes the Student Registration form.

EVALUATIO

N ONLY

Page 53: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 53

1.9 Creating an AutoKeys Macro

In this lesson, you will learn how to assign a macro to a specific keystroke combination.

nother special macro available is the AutoKeys macro. The AutoKeys macro allows you to assign a keystroke combination to a macro, thus allowing you to execute the macro from anywhere in your database.

To assign a macro to a keystroke, you will need to create a new macro group and name it AutoKeys. For each submacro, type the keystroke combination you want to assign in the Submacro box and then enter any actions you want your macro to perform. Any macros that you want to assign to keystrokes will need to be stored in this AutoKeys macro.

A trick that many Access programmers use is assigning the F11 key to a message box. If you have decided to hide the Navigation Pane from your users, they could easily redisplay it by pressing the F11 key. To prevent them from overriding your wishes to keep the Navigation Pane hidden, add the F11 keystroke combination to your AutoKeys macro.

To enter keystroke combinations, use the SendKeys syntax in the table on the next page. For instance, to enter the keystroke combination Ctrl + F7, you would type ^{F7} in the macro names column. To change the behavior of the F11 key (the trick that we mentioned above), type {F11} in the Macro Names column.

A

EVALUATIO

N ONLY

Page 54: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 54

SendKeys Syntax Keystroke

Combination

^A or ^4 CTRL+A or CTRL+4

{F1} F1

^{F1} CTRL+F1

+{F1} SHIFT+F1

{INSERT} INS

^{INSERT} CTRL+INS

+{INSERT} SHIFT+INS

{DELETE} or {DEL} DEL

^{DELETE} or

^{DEL}

CTRL+DEL

+{DELETE} or

+{DEL}

SHIFT+DEL

To Assign an Action or Set of Actions to a Keystroke

Combination

1. Create a blank new Macro. 2. Click the Add New Action drop-down arrow and choose Submacro from the

list. Or Expand the Program Flow category in the Action Catalog window and

double-click Submacro. 3. Click in the Submacro box and then type the key or key combination to

which you want to assign macro actions. This is how you identify each individual AutoKeys macro.

4. Add the actions to the group you want the macro to carry out. 5. To add another macro, click anywhere outside of the group and repeat steps 2-

4. 6. Save the macro group with the name AutoKeys.

EVALUATIO

N ONLY

Page 55: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 55

Let’s Try It!

What Why

1. Click the Create tab on the Ribbon.

Switches Create commands and tools.

2. Click the Macro button on the Ribbon.

Opens a blank new Macro window.

3. Click the Add New Action arrow and choose Submacro from the list.

Adds the Submacro action to the Macro window.

4. Click in the box to the right of the words Submacro and then type: {F11} as shown below.

Specifies the keystroke combination of F11.

5. Click the arrow in the Add New Action box (directly under the Submacro line).

Displays the Macro Action list.

6. Type: M Jumps to macro actions beginning with the letter M.

7. Select MessageBox from the action list.

Selects the Message Box action. This action will execute when F11 is pressed.

8. In the Action Arguments section, click in the Message box and then type: You cannot unhide the Navigation Pane this way. See your system administrator.

Enters the message that the user will receive after pressing F11. EVALU

ATION O

NLY

Page 56: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 56

What Why

9. Click in the Type box and then select Information from the drop-down list.

Specifies the type of message box the user it is to receive.

10. Click in the Title box and then type: Cannot Unhide Window!

Specifies a title for the message box.

11. Click anywhere below the words End Submacro.

Sets the focus outside of the Submacro block.

12. Click the Add New Action arrow (directly under End Submacro) and choose Submacro from the list.

Adds another submacro to our AutoKeys macro.

13. Click in the blank box to the right of the words Submacro and then type: ^r.

Specifies the keystroke combination of Ctrl + R

14. Click the arrow in the Add New Action box and then type: O

Jumps to macro actions beginning with the letter O.

15. Click the OpenForm action. Selects the macro action.

16. In the Action Arguments section in the center pane, click in the Form Name box.

Displays the form list arrow.

17. Select frmStudentRegistration from the Form Name list.

Selects frmStudentRegistration as the action argument.

18. Click the Save button on the Quick Access Toolbar.

Displays the Save As dialog box.

19. Type: AutoKeys in the Macro Name box.

Specifies a name for our macro.

20. Click OK. Closes the Save As dialog box. EVALUATIO

N ONLY

Page 57: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 57

What Why

21. Press the Ctrl + W keystroke combination.

Closes the Macro.

22. Press the Ctrl + R keystroke combination.

Opens the Student Registration form as we specified in the AutoKeys macro.

23. Press the F11 key. Displays the message box that we specified in the AutoKeys macro and overrides the unhide Navigation Pane action.

24. Click OK. Closes our custom message box.

25. Press the Ctrl + W keystroke combination.

Closes the Form.

EVALUATIO

N ONLY

Page 58: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 58

1.10 Creating a Data Macro

In this lesson, you will learn how to use data macros.

ata Macros allow you to add macros to events in your tables. This includes events such as adding, updating or deleting data in your tables. Storing macros in your tables means that the macro can be triggered from a table, form, or query. For instance, you can create a macro to automatically send an e-mail to your

customers once an order is entered in the database or to automatically insert a salary amount dependent on the employee’s assigned level.

The Table tab on the Ribbon displays the different types of events to which you can attach macros.

To Create an Event-Driven Data Macro

1. Double-click the table to which you want to add a data macro. 2. Click the Table tab on the Ribbon. 3. Click the event that you want to trigger the macro from the Before Events or

After Events group on the Ribbon. 4. Add the action that you want to macro to carry out. Add any necessary

parameters.

D

EVALUATIO

N ONLY

Page 59: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 59

5. Save and close the macro.

Let’s Try It!

What Why

1. Click the Navigation Pane header and choose Tables.

Displays all table objects in the database.

2. Double-click tblClasses. Opens tblClasses in datasheet view.

3. Click the Table tab on the Ribbon as shown below.

Displays commands and options for the contextual Table tab.

4. Click the Before Change button on the Ribbon.

Specifies that the macro will be executed before the record is changed. The macro window is then displayed.

5. Double-click the If action in the Action Catalog.

Adds the If action to the macro window.

6. Type: Cr Access automatically displays the field names in the table as you type.

7. Press Tab. Adds the field [Credits] to the If box.

8. Type: = “3” as shown below. Enters the first If statement

EVALUATIO

N ONLY

Page 60: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 60

What Why

9. Click the Add New Action drop-down arrow and choose SetField from the list.

Specifies that we wish to change the data of a field in our table.

10. Click in the Name box and type: Cl.

Displays a list of available fields in the table..

11. Press Tab. Adds the first field, ClassCost to the box.

12. Click in the Value box and type: 360 as shown below.

Specifies the value to which the field is be changed when the If condition is true

13. Click the Add ElseIf link. Allows us to test for a second condition. EVALUATIO

N ONLY

Page 61: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 61

What Why

14. Click in the Else If box and type: [Credits] = “4” as shown below.

Enters the ElseIf condition to test.

15. Inside of the ElsefIf block, click the Add New Action drop-down arrow and choose SetField from the list.

Specifies that we wish to change the data of a field in our table.

16. Click in the Name box and type: ClassCost.

Specifies the field we want to change.

17. Click in the Value box and type: 480.

Specifies the value to which the field is be changed when the Else If condition is true.

18. Click the Save button on the Quick Access toolbar.

Saves our macro.

19. Press Ctrl + W. Closes the macro window.

20. In tblClasses, click in the ClassName field in the first blank row at the end of the table.

Allows us to enter a new record.

21. Type: Spanish for Travelers and then press the Tab key.

Enters the Class name and then moves to the Department field.

22. Type: Spanish and then press the Tab key.

Enters Spanish as the Department and then moves to the next field. EVALU

ATION O

NLY

Page 62: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 62

What Why

23. Type 4 and then press the Down Arrow key.

Moves to a new record. Notice that the ClassCost value is automatically inserted for us.

24. Press Ctrl + W. Closes the table.

EVALUATIO

N ONLY

Page 63: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 63

1.11 Adding a Macro to the Quick

Access Toolbar

In this lesson, you will learn how to add your macros to the Quick Access Toolbar.

f there are particular macros that you excecute often, you can add them to the Quick Access Toolbar for easy access. After you create a macro, it then appears in the Macros category of available commands that you can add to the toolbar. To make your macros stand out, Access also allows you to choose from a variety of icons that

you can apply to your toolbar macros.

To Assign a Macro to the Quick Access Toolbar

1. Click the Customize Quick Access Toolbar arrow to the right of the toolbar.

2. Click More Commands. 3. Click the Choose command from arrow and click Macros to display all

available macros. 4. Click the macro you wish to add to the toolbar and then click the Add button. 5. To modify its position on the toolbar, click the Move Up or Move Down

button on the far right side of the pane. 6. Click the Modify button.

I

EVALUATIO

N ONLY

Page 64: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 64

7. Click in the Display name box and type in a name for the macro (when you point to a macro button on the Quick Access toolbar, the name you designate here will appear).

8. Click the icon you wish to use in the Symbol box. 9. Click OK to close the Modify Button dialog box. 10. Click OK to close the Access Options dialog box.

Let’s Try It!

What Why

1. Click the Customize Quick Access Toolbar arrow to the right of the toolbar as shown below.

Displays the Customize Quick Access Toolbar menu.

2. Click More Commands from the menu.

Displays the Customize category of the Access Options dialog box.

3. Click the Choose command from arrow and click Macros as shown below.

Displays all available macros.

EVALUATIO

N ONLY

Page 65: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 65

What Why

4. Click the mcrOpenForms.OpenStudents macro as shown below and then click the Add button.

Adds the macro to the Quick Access Toolbar list.

5. Click the Modify button on the bottom of the right window.

Displays the Modify Button dialog box from where we can choose an icon for our macro and provide a macro name.

6. Triple-click in the Display name box and type Add Students as shown below.

Provides a name for the macro. This is the name that will display when you point to the macro button on the Quick Access toolbar.

EVALUATIO

N ONLY

Page 66: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 66

What Why

7. Click the icon in the 4th row, 7th column (the person icon).

Selects the icon for our macro.

8. Click OK. Closes the Modify Button dialog box.

9. Click OK. Closes the Access Options dialog box.

10. Move your mouse pointer over the new icon that we added to the Quick Access Toolbar.

Displays the name of the macro. EVALUATIO

N ONLY

Page 67: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 67

What Why

11. Click the new icon for the Add Students macro.

Executes the macro.

12. Click the File tab and choose Close from the File Options menu.

Closes the database.

EVALUATIO

N ONLY

Page 68: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 68

Lesson 1 Quiz

1. A Macro is: A. A series of keystrokes and actions that are recorded and then saved. B. Another word for an Argument that is passed to an expression. C. A series of actions that are executed in sequential order. D. A message box that is displayed when a form in launched.

2. When creating a macro, the OpenForm command can be added to the macro by clicking the ____________________ (fill in the blank) drop-down arrow.

3. In what Access view do you make changes to an existing macro? A. Design View B. Create View C. Macro View D. Argument View

4. You have added a macro to a command button and want the macro to execute when the user clicks the button. To which button property do you add the macro?

A. Button Click B. On Lost Focus C. On Got Focus D. On Click

5. You can assign a macro to a text box on a form. A. True B. False

6. In order to create a macro group, you will need to add two or more ______________________ (fill in the blank) to the macro.

7. How can you test your macro by having it perform one step at a time and pausing after each step?

A. Click the Pause button on the Design Ribbon and then run the macro. B. Click the Test Macro button on the Design Ribbon and then run the macro. C. Click the Single Step button on the Design Ribbon and then run the macro. D. Insert a blank row between each macro action in macro design view.

8. You want to create a conditional macro in a form named “Students” that will display a message when a user moves off of the State text box control if the value in the text box is “FL”. Write the expression that you would enter into the Condition box.

EVALUATIO

N ONLY

Page 69: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

© 2016 PCM Courseware, LLC 69

9. You want a macro to run every time your database is opened. What type of macro will accomplish this?

A. AutoKeys B. AutoExec C. AutoOpen D. Executable

10. You want to prevent a user from using the F11 keystroke combination to unhide the Navigation Pane. How can you do this by using a macro?

11. You want your Registration form to automatically open when you press the Ctrl + R

keystroke combination. What is the AutoKeys syntax that will accomplish this? A. {Ctrl}r B. Ctrl {r} C. ^Ctrl {r} D. ^r

12. Describe the steps to add an icon to the Quick Access toolbar that will execute a macro.

EVALUATIO

N ONLY

Page 70: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 1 – W O R K I N G W I T H M A C R O S

Access 2016 Level 3 70

LAB 1 – ON YOUR OWN

1. Open the Lab1 database in the Lesson Files folder.

2. Create a new macro that opens the frmOrderEntry form and then maximizes the form. Save the macro as mcrOrderEntry. Test the macro. Close frmOrderEntry and close mcrOrderEntry.

3. Create a new macro that opens the rptProducts_by_Category report in Print Preview view. (Hint: Use the OpenReport action and select Print Preview from the View list). Save the macro as mcrOpenProductsReport. Test the macro. Close the report and the macro.

4. Open the frmProducts_by_Category form in Design View. Deactivate the Control Wizard on the Ribbon. Add a command button to the Form Header and display the properties for the command button. Assign the mcrOpenProductsReport to the On Click event of the Command Button. Set the Caption property of the Command Button to read: Open Report. Close the Property Sheet Pane. Switch to Form View and test the macro by clicking the Command Button. Close the report and the form, saving any changes.

5. Create an AutoExec macro that opens frmOrderEntry and then maximizes the form when the database is opened. Close and reopen the database to test the macro. Close the frmOrderEntry form.

6. Create an AutoKeys macro that will close the database (use the RunMenuCommand action and CloseDatabase as the command) and exit Access (Hint: Use the “QuitAccess” action). Don’t forget to enclose your actions within a Submacro. Assign the keystroke combination of Ctrl + F7. Test the macro.

EVALUATIO

N ONLY

Page 71: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

© 2016 PCM Courseware, LLC 71

Lesson 2 - Action Queries

Lesson Topics:

2.1 About Action Queries

2.2 Creating a Make-Table Query

2.3 Creating an Append Query

2.4 Creating an Update Query

2.5 Creating a Delete Query

2.6 Creating a SQL Query

Lesson

2

EVALUATIO

N ONLY

Page 72: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

Access 2016 Level 3 72

2.1 About Action Queries

In this lesson, you will learn about Action Queries.

n Action Query is a query that physically changes the data in your database. It can make changes to or move many records in one operation. Select Queries on the other hand, simply return a recordset of data from your database, without changing the data.

When you open an existing database, Access displays a security warning that the database contains potentially harmful code and disables certain features in the database. One of the features that is disabled is the execution of action queries. If you trust the author of the database, click the Enable Content button in the Security Warning area, below the Ribbon.

There are four types of Action Queries:

Make-table Query – The Make-table query find records based on your criteria, then creates a new table from that data. Make-table queries are especially helpful for archiving old data or exporting data to another Access database.

Append Query – The Append query finds records based on your criteria and then adds the records from one table to the end of another table. For example, you might have a separate database containing new products for the year. Instead of retyping all of them manually, you could import the data from the new products table into your existing products table using an Append Query.

Update Query – The Update query find records based on your criteria then makes global changes to the data. For example, you could raise all of your prices at once by 15% by using an Update Query.

Delete Queries – The Delete Query finds records based on your criteria then removes the records from the table. Delete queries always delete entire records, not just selected fields within records!

In this lesson, we will work with all four of these queries.

A

EVALUATIO

N ONLY

Page 73: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

© 2016 PCM Courseware, LLC 73

2.2 Creating a Make-Table Query

In this lesson, you will learn how to create a Make-table Query.

Make-table Query allows you to create a new table consisting of records from an existing table. There are many uses for a Make-table query. For example, Make-table queries are helpful for exporting data for use in another Access database. Or you can create an archive table that contains old records, such as all

of your old orders that you wish to delete from your current Orders table. You can also use a Make-table query to generate a backup copy of a table.

To create a Make-table query, build a query, adding any fields that you would like exported to your new table. Include any desired criteria. Click the Make Table button on the Query Type group on the Ribbon, enter the name of the new query in the Table Name box and then specify whether the new table should reside in the existing database or in another database. Running the query will create your new table.

A

EVALUATIO

N ONLY

Page 74: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

Access 2016 Level 3 74

To Create a Make-Table Query

1. Click the Create tab on the Ribbon. 2. Click the Query Design button on the Queries group. 3. In the Show Table dialog box, double-click any table whose fields you wish to

include in the new table. 4. Click Close. 5. Double-click the field(s) that you wish to include in the new table, along with

any fields you want to use for setting criteria. 6. Add any Criteria in the Criteria cell. 7. Click the Make Table button on the Query Type group. 8. In the Table Name box, type the desired name for the table. 9. If the table is in the currently opened database, click the Current Database

radio button. 10. If table is to reside in another database: a. Select Another Database radio button. b. Click the Browse button. c. Navigate to the folder where the database is located. d. Select the database. e. Click OK. 11. Click OK to close the Make-table dialog box. 12. Click the Run button on the Ribbon to execute the query.

In the Let’s Try It Exercise, we will create a new table that includes student class registration data from the Fall semester of 2003.

Let’s Try It!

What Why

1. Open the Microsoft Access application.

Launches Microsoft Access and displays the Getting Started Pane.

2. Click Open Other Files in the left pane.

Displays the Open dialog box.

3. Click the Browse button in the center pane.

Displays the Open dialog box.

4. Click the Desktop on the left side of your screen.

Displays the Desktop folder. EVALUATIO

N ONLY

Page 75: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

© 2016 PCM Courseware, LLC 75

What Why

5. Double-click the Lesson Files folder.

Opens the Lesson Files folder and displays the files in that folder.

6. Click the Lesson 2 file and then click Open.

Opens the Lesson 2 database.

7. In the Security pane above the Navigation Pane, click the Enable Content button as shown below.

Enables the execution of action queries. By default, Access will not allow you to execute any action queries unless you enable such content.

8. If asked whether you wish to make this a Trusted Document, click Yes.

Allows you to make changes to the document.

9. Click the Create tab on the Ribbon. Displays Create commands and tools.

10. Click the Query Design button on the Queries group.

Displays the Show Table dialog box.

11. Select tblStudents and then click the Add button.

Adds tblStudents to the query.

12. Select tblStudentClasses and then click the Add button.

Adds tblStudentClasses to the query.

13. Select tblClasses and then click the Add button.

Adds tblClasses to the query. EVALUATIO

N ONLY

Page 76: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

Access 2016 Level 3 76

What Why

14. Click Close. Closes the Show Table dialog box.

15. In the tblStudents field list, double-click the following fields as shown below:

StudentID FirstName LastName

Adds the StudentID, FirstName and LastName fields to the query grid.

16. In tblStudentClasses field list, double-click the following fields:

Semester Year

Adds the Semester and Year fields to the query grid.

17. In the tblClasses field list, double-click the following fields:

ClassName Credits

Adds the ClassName and Credits table to the query grid.

18. Click in the Criteria row for the Semester field and then type: “Fall” as shown below.

Enters a criterion of “Fall” for the semester field.

EVALUATIO

N ONLY

Page 77: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

© 2016 PCM Courseware, LLC 77

What Why

19. Click in the Criteria row for the Year field and then type: 2013.

Enters a criterion of “2013” for the year field.

20. Click the Run button and observe the data.

Runs the query. Only records from Fall 2013 are included in the results.

21. Click the View button. Switches back to Design view.

22. Click the Make Table button on the Query Type group on the Ribbon as shown below.

Displays the Make Table dialog box.

23. In the Table Name box, type: tblFall_2013_data as shown below.

Enters a name for the new table. EVALUATIO

N ONLY

Page 78: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

Access 2016 Level 3 78

What Why

24. Click OK. Closes the Make Table dialog box.

25. Click the Save icon on the Quick Access Toolbar and type: mqryMake_2013_data in the Query Name box. Click OK.

Specifies a name for the new query.

26. Click the Run button. Receives warning message. This is your one chance to change your mind as you cannot undo this action!

27. Click Yes. Executes the query and creates the new table.

28. Press the Ctrl + W keystroke combination.

Closes the query.

29. Click the Navigation Bar and select Queries.

Displays only query objects. Notice that the symbol for the Make-table Query is different than for a Select query.

30. Click the Navigation Bar and click Tables.

Switches to Table objects.

31. Double-click tblFall_2013_Data. Opens the table that we created. EVALUATIO

N ONLY

Page 79: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

© 2016 PCM Courseware, LLC 79

What Why

32. Press the Ctrl + W keystroke combination.

Closes the table.

EVALUATIO

N ONLY

Page 80: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

Access 2016 Level 3 80

2.3 Creating an Append Query

In this lesson, you will learn how to create an Append Query.

n Append Query adds a group of records from one table to the end of another table based on your criteria. For example, you may have created a list of new products for the year in an Excel spreadsheet and imported it into your Access database. Using an Append Query, you can add the data from your new products

table into your existing products table.

It is important to note that the data type of the records you are appending must match the data type in the table to which you are adding them. Otherwise, you will receive an error message when executing the query and the action will not be carried out successfully.

To Create an Append Query

1. Click the Create tab on the Ribbon. 2. Click the Query Design button on the Queries group. 3. In the Show Table dialog box, double-click only the table whose records you

want to append to another table. 4. Click Close. 5. Click the Append button on the Query Type group.

A

EVALUATIO

N ONLY

Page 81: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

© 2016 PCM Courseware, LLC 81

6. Click in the Table Name box, and then select the table to which you want to append records.

7. If the table is in the currently opened database, click the Current Database radio button.

8. If the database is not the currently opened database: a. Select the Another Database radio button. b. Click the Browse button. c. Navigate to the folder where the database is located. d. Select the database. e. Click OK. 9. Double-click the fields you want to append in the Field List box, along with

any fields you want to use for setting criteria. 10. If the fields you've selected have the same name in both tables, Access

automatically fills the matching name in the Append To row. If the fields in the two tables do not have the same name, click in the Append To row for the field and then select the name of the field in the table to which you want to append.

11. Click the Run button to execute the query.

Note: If all the fields in both tables have the same names, you can just drag the asterisk (*) to the query design grid if appending all of the records.

In the Let’s Try It exercise, we are going to append data from the New Classes Table to our existing Classes table.

Let’s Try It!

What Why

1. Double-click tblClasses in the Navigation Pane and observe the number of records.

Opens tblClasses. Note that there are 39 records.

2. Press Ctrl + W. Closes tblClasses.

3. Click the Create tab on the Ribbon. Switches to Create commands and tools.

4. Click the Query Design button on the Queries group on the Ribbon.

Displays the Show Table dialog box. EVALUATIO

N ONLY

Page 82: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

Access 2016 Level 3 82

What Why

5. Select tblNewClasses from the Show Table box and then click Add.

Adds the table from which we want to append data.

6. Click Close. Closes the Show Table dialog box.

7. Click the Append button on the Query Type group on the Ribbon as shown below.

Displays the Append dialog box.

8. Click in the Table Name box and select tblClasses from the drop-down list as shown below.

Selects the table to which we want to append records.

9. Click OK. Closes the Append dialog box and adds the Append To row to the query grid.

10 Double-click ClassID in the Field List window.

Adds the ClassID field to the query grid.

11. Double-click ClassName in the Field List window.

Adds the ClassName field to the query grid.

EVALUATIO

N ONLY

Page 83: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

© 2016 PCM Courseware, LLC 83

What Why

12. Double-click Department in the Field List window.

Adds the Department field to the query grid.

13. Double-click Credits in the Field List window.

Adds the Credits field to the query grid.

14. Double-click Cost in the Field List window and observe the Append To row.

The Cost field does not appear in the Append To row because the field name is not the same in both tables. We will have to select the Append To field manually.

15. Click in the Append To row for the Cost field and then select ClassCost from the drop-down list as shown below.

Selects the field in tblNewClasses to which we want to append the Cost field in tblClasses.

16. Click the Save button on the Quick Access Toolbar and then type: aqryAppendToNewClasses in the Query Name box. Click OK.

Specifies a name for our query. EVALUATIO

N ONLY

Page 84: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

Access 2016 Level 3 84

What Why

17. Click the Run button. Displays a warning box, confirming that you want to execute the Append Query.

18. Click Yes. Closes the warning box and executes the query.

19. Press the Ctrl + W keystroke combination.

Closes the query.

20. Double-click tblClasses in the Navigation Pane and observe the number of records.

Opens tblClasses. Notice that there are now 46 records.

21. Press the Ctrl + W keystroke combination.

Closes the table.

EVALUATIO

N ONLY

Page 85: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

© 2016 PCM Courseware, LLC 85

2.4 Creating an Update Query

In this lesson, you will learn how to create an Update Query.

n Update Query changes data in a group of records at the same time. For example, you may decide to raise your prices by 15%. Rather than type in the new price manually for each record, you can create an update query to raise each price entry by 15%. Or perhaps you have a salesperson who resigns from your

company. With an update query, you can change the salesperson’s name for all of his/her clients to the new salesperson’s name at once.

To Create an Update Query

1. Click the Create tab on the Ribbon. 2. Click the Query Design button on the Queries group. 3. In the Show Table dialog box, select the table whose data you wish to change. 4. Click Add. 5. Click Close. 6. Double-click the field(s) whose data you wish to change in the Field List box,

along with any fields you want to use for setting criteria. 7. Add any Criteria in the Criteria cell. 8. Click the Update button on the Query Type group on the Ribbon. 9. In the Update To cell for the field(s) you wish to update, type an expression

or value that you want to use to change the data in the fields. 10. Click the Run button to execute the query.

A

EVALUATIO

N ONLY

Page 86: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

Access 2016 Level 3 86

Let’s Try It!

What Why

1. Double-click tblClasses and observe the value in the ClassCost field.

Opens tblClasses. Observe that a 3 credit class costs $360 and a 4 credit class costs $480.

2. Press the Ctrl + W keystroke combination.

Closes tblClasses.

3. Click the Create tab on the Ribbon. Displays Create commands and tools.

4. Click the Query Design button on the Queries group on the Ribbon.

Displays the Show Table dialog box.

5. Select tblClasses from the Show Table dialog box and then click Add.

Adds the table whose data we wish to modify.

6. Click Close. Closes the Show Table box.

7. Click the Update button on the Query Type group as shown below.

Changes the query to an Update Query and displays the “Update To” row in the query grid.

8. Double-click ClassCost in the Field List window.

Adds the ClassCost field to the query grid. EVALU

ATION O

NLY

Page 87: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

© 2016 PCM Courseware, LLC 87

What Why

9. Click in the Update To row for the ClassCost field and then type: [ClassCost] * 1.06 as shown.

Enters an expression to increase the value of the ClassCost field by 6%.

10. Click the Save button on the Quick Access Toolbar and then type: uqryUpdateClassCost in the Query Name box. Click OK.

Specifies a name for our query.

11. Click the Run button. Receives a warning box asking you if you really want to update the records. Clicking no cancels the update process.

12. Click Yes. Updates the records in the ClassCost field to the new value.

13. Press the Ctrl + W keystroke combination.

Closes the query.

14. Double-click tblClasses in the Navigation Pane and observe the ClassCost field.

The original values have increased by 6%.

15. Press the Ctrl + W keystroke combination.

Closes tblClasses. EVALU

ATION O

NLY

Page 88: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

Access 2016 Level 3 88

EVALUATIO

N ONLY

Page 89: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

© 2016 PCM Courseware, LLC 89

2.5 Creating a Delete Query

In this lesson, you will learn how to create a Delete Query.

Delete Query is the most dangerous of all of the Action Queries as it will permanently delete a group of records from one or more tables – and you cannot undo the action! Therefore, it is highly recommended that you backup your data before running a delete query, or any other action query for that matter.

Mistakes can be made and you could inadvertently delete the wrong set of data.

When might you want to use a Delete Query? You might, for example, want to delete all old orders from your Orders table before a certain date. With delete queries, you delete the entire record, not just the fields you add to the delete query.

An important thing to keep in mind with Delete Queries is that if you are deleting a record from a table that is involved in a relationship and have set the Cascade Delete Related Records option in the Edit Relationships box, any related records will be deleted as well. Additionally, if your table is the Parent table in a one-to-many relationship and referential integrity is enforced, you will need to delete the related records in the Child Table first before being able to delete the desired records in the parent table (unless the Cascade Delete Related Records option is set).

A

EVALUATIO

N ONLY

Page 90: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

Access 2016 Level 3 90

To Create a Delete Query

1. Click the Create tab on the Ribbon. 2. Click the Query Design button on the Queries group. 3. In the Show Table dialog box, select the table whose data you wish to delete. 4. Click Add. 5. Click Close. 6. Add any fields on which you want to set criteria to the Query grid. 7. Enter any desired Criteria in the Criteria cell. 8. To specify that all records are to be deleted, drag the asterisk (*) from the Field

List box to the Query grid. 9. Click the Delete button on the Query Type group on the Ribbon. 10. Click the Run button on the Ribbon to execute the query.

In the Let’s Try It! exercise, we are going to delete all records in tblStudentClasses table from Fall 2013.

Let’s Try It!

What Why

1. Double-click tblStudentClasses in the Navigation Pane and observe that there are 52 records.

Opens tblStudentClasses in Datasheet View.

2. Press the Ctrl + W keystroke combination.

Closes tblStudentClasses.

3. Click the Create tab on the Ribbon. Switches to Create commands and tools.

4. Click the Query Design button on the Queries tab on the Ribbon.

Displays the Show Table dialog box.

5. Select tblStudentClasses from the Show Table box and then click Add.

Adds the table that contains the records we wish to delete.

6. Click Close. Closes the Show Table box. EVALUATIO

N ONLY

Page 91: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

© 2016 PCM Courseware, LLC 91

What Why

7. Click the Delete button on the Query Type group as shown below.

Changes the query to a Delete Query.

8. Double-click Semester in the Field List window.

Adds the Semester field to the query grid.

9. Double-click Year in the Field List window.

Adds the Year field to the query grid.

10. Click in the Criteria row for the Semester field and then type: Fall.

Enters criteria of “Fall” for the Semester field.

11. Click in the Criteria row for the Year field and type: 2013.

Enters criteria of “2013” for the year field.

12. Click the Save button on the Quick Access Toolbar and then type: dqryDeleteFall2013 in the Query Name box. Click OK.

Specifies a name for our query.

13. Click the Run button. Receives a warning message box confirming that you really wish to delete the records. Clicking no cancels the delete process.

14. Click Yes. Deletes all records from tblStudentClasses that have 2003 in the Year field and have Fall in the Semester field.

15. Press the Ctrl + W keystroke combination.

Closes the query. EVALU

ATION O

NLY

Page 92: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

Access 2016 Level 3 92

What Why

16. Double-click tblStudentClasses in the Navigation Pane and observe the number of records.

There are now only 12 records in the table.

17. Press the Ctrl + W keystroke combination.

Closes the table.

EVALUATIO

N ONLY

Page 93: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

© 2016 PCM Courseware, LLC 93

2.6 Creating a SQL Query

In this lesson, you will learn how to create a SQL Query.

QL (Structured Query Language) is a powerful database language used in queries. Each query that you create has an underlying SQL statement, which you can view or edit by clicking the View button arrow on the Home Ribbon and then click SQL view. If you know SQL, you can create Select Queries as well as Action Queries by

typing in the SQL statement in the SQL window.

An example of a simple select SQL statement would be: SELECT * FROM tblCustomers. This statement returns all records from tblCustomers. If you want to delete all records from tblCustomers from the state of Michigan, the equivalent SQL statement would read: DELETE * FROM tblStudents WHERE State = "MI".

To Create a SQL Query

1. Click the Create tab on the Ribbon. 2. Click the Query Design button on the Queries group. 3. In the Show Table dialog box, click the Close button. 4. Click the arrow on the View button and then click SQL View. 5. Type your SQL commands to create the query. 6. Click the Run button on the Ribbon to execute the query.

Tip: You can also click the SQL button on the lower right corner of the query window to switch to SQL view.

S

EVALUATIO

N ONLY

Page 94: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

Access 2016 Level 3 94

Let’s Try It!

What Why

1. Click the Create tab on the Ribbon. Switches to Create commands and tools.

2. Click the Query Design button on the Queries tab on the Ribbon.

Displays the Show Table dialog box.

3. Click the Close button on the Show Table dialog box.

Closes the Show Table dialog box and displays a blank query window.

4. Click the arrow on the View button and click SQL View.

Switches from Design View to SQL View.

5. In the SQL window, type: SELECT * FROM tblStudents as shown below.

Enters a SQL Statement that will return all records from the tblStudents table.

6. Click the Run button on the Ribbon.

Executes the query. EVALUATIO

N ONLY

Page 95: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

© 2016 PCM Courseware, LLC 95

What Why

7. Click the arrow on the View button and click SQL View.

Switches from Datasheet View to SQL View. The SQL statement is automatically highlighted.

8. Delete any existing text in the SQL window and then type: DELETE * FROM tblStudents WHERE State = “WI” as shown below.

Enters a SQL Statement to delete all records from the tblStudents table for the state of Wisconsin.

9. Click the Run button on the Ribbon.

Displays a message box informing you that you are about to delete 8 records.

10. Click Yes. Executes the query and deletes the records.

11. Click the arrow on the View button and click Design View.

Displays the query in Design View.

12. Press the Ctrl + W keystroke combination. Click No when asked to save your changes.

Closes the query without saving it. EVALUATIO

N ONLY

Page 96: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

Access 2016 Level 3 96

What Why

13. Click the File tab and then click Close from Backstage view.

Closes the database.

EVALUATIO

N ONLY

Page 97: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

© 2016 PCM Courseware, LLC 97

Lesson Summary – Action Queries

In this lesson, you learned that an Action Query is a query that physically changes the data in your database. It can make changes to or move many records in one operation whereas Select Queries simply return a recordset of data from your database, without changing the data. You learned that there are four types of Action Queries: Make-Table, Update, Delete and Append.

Then, you learned that a Make-table Query allows you to create a new table consisting of records from an existing table. To create a Make-table query, build a query, add any fields that you would like exported to your new table and include any desired criteria. Click the Make Table button on the Query Type group on the Ribbon, enter the name of the new table in the Table Name box and then specify whether the new table should reside in the existing database or in another database. Running the query will create your new table.

Next, you learned how to create an Append Query, which adds a group of records from one table to the end of another table based on your criteria. To create an Append query, build a query, add any fields and your desired criteria. Click the Append button on the Query Type group on the Ribbon, and select the name of the table which is to receive the records. If the fields in the two tables do not have the same name, click in the Append To row for the field and then select the name of the field in the table to which you want to append.

Next, you created an Update Query, which allows you to change data in a group of records at the same time. To create an Update query, build a query, and add the field(s) whose data you wish to change along with any fields you want to use for setting criteria. Add any Criteria in the Criteria cell. Click the Update button on the Query Type group on the Ribbon and type in the expression in the Update To row in the query grid.

Next, you learned how to create a Delete query that will permanently delete a group of records from one or more tables. To create a Delete query, build a query and add the fields you want to use for setting criteria. Add any Criteria in the Criteria cell and click the Delete button on the Query Type group on the Ribbon.

Lastly, you learned that SQL (Structured Query Language) is a powerful database language used in queries. Each query that you create has an underlying SQL statement, which you can view or edit by clicking the View button arrow on the Home Ribbon and then clicking SQL view. If you know SQL, you can create Select Queries and well as Action Queries by typing in the SQL statement in the SQL window.

EVALUATIO

N ONLY

Page 98: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

Access 2016 Level 3 98

Lesson 2 Quiz

1. What are the four types of action queries?

2. The action query buttons are located on the _________________ group on the Design Ribbon.

3. You have a table of new products whose records you want to add to your existing products table. What type of action query would you use?

A. Make-Table Query B. Select Query C. Append Query D. Update Query

4. What type of query will change data in a group of records at the same time? 5. You want to create an Append Query but the field name for one of your fields is not

the same in both tables. What do you need to do to solve this? A. Select the matching field in the destination table from the Update To Row. B. Select the matching field in the destination table from the Matching Row. C. Select the matching field in the destination table from the Criteria Row. D. Select the matching field in the destination table from the Append To Row.

6. You want to update your prices by 15%. Describe the process of creating a query that will accomplish this using the Cost field.

7. Which type of query will remove records from an existing table based upon the criteria

you enter? A. Remove Records Query B. Delete Query C. Append Query D. Update Query

8. Your company president resigned and a new president has been hired to replace her. To change all instances of the former president’s name to the name of the new president, you would create a(n)___________________________ query.

9. A SQL statement can contain a select query statement or an action query statement. A. True

EVALUATIO

N ONLY

Page 99: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

© 2016 PCM Courseware, LLC 99

B. False 10. You have created a Delete query. You added only the State field to the query grid

with no criteria. Which records will be deleted when you execute the query?

EVALUATIO

N ONLY

Page 100: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 2 – A C T I O N Q U E R I E S

Access 2016 Level 3 100

LAB 2 – ON YOUR OWN

1. Open the Lab2 database in the Lesson Files folder and click the Enable Content button in the Security Warning area.

2. Create a new query that includes all of the fields from tblOrders. Convert the query to a Make-table Query that includes only those records whose order date is before 1/1/2002. Name the new table: tblOrdersArchive. Save the query as mqryMakeOrdersArchive. Run the query. Close the query.

3. Create a new query that includes only the Price field from tblProducts. Transform the query into an Update Query. Type an expression in the Update To: row that will increase all of the prices by $5.00 (Hint: Add 5 to the price field). Save the query as uqryUpdatePrices. Run the query. Close the query.

4. Create a new query that will append all of the data from tblNewProducts to tblProducts. Save the query as aqryAppendNewProducts. Run the query. Close the query.

5. Create a new query that includes tblOrders. Turn the query into a Make-table Query and name the new table tblOrders_backup. Drag the asterisk from the Field List to the query grid to include all records. Save the query as mqryMakeOrdersBackup. Run the query. Close the query.

6. Create a new Delete Query that will delete any record from tblOrders whose order date is before 1/1/02. Save the query as dqryDeleteOldOrders. Run the query.

7. Close the database.

EVALUATIO

N ONLY

Page 101: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 101

Lesson 3 - Importing and Exporting

Data

Lesson Topics:

3.1 Importing Data from a Text File

3.2 Importing Data from Excel

3.3 Importing Data from another Access Database

3.4 Linking Data

3.5 Exporting Data to other Formats

3.6 Exporting Data to a PDF File

3.7 Exporting Data to another Access Database

3.8 Exporting Data to Excel

3.9 Exporting Data to Microsoft Word

3.10 Exporting Data to a Microsoft Word Mail Merge

Lesson

3

EVALUATIO

N ONLY

Page 102: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 102

3.1 Importing Data from a Text File

In this lesson, you will learn how to import data into Access from a text file.

icrosoft Access allows you to bring in or Import data from text files to use in your Access database. You can import data from either a delimited text file, in which each field is separated by a delimiter such as a comma, or from a fixed-width text file, in which each field has a fixed width. Access has a

convenient Text Import Wizard which steps you through the process of importing a text file.

When importing data from a text file, you can either store the imported data in a new table or append it to an existing table (as long as the first row of your text file matches the table's field names).

To Import a Text File into Access

1. Click the External Data tab on the Ribbon. 2. Click the Text File button on the Import & Link group on the Ribbon. 3. Click the Browse button and then navigate to the folder that contains the text

file you want to import. 4. Select the file and then click the Open button.

M

EVALUATIO

N ONLY

Page 103: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 103

5. If you want to import your data to an existing table: a. Select the radio button next to Append a copy of the records to the

table: b. Choose the table into which you want to import the text file from the

drop-down list. c. Click OK. d. Choose Delimited or Fixed Width. e. Click Next. f. If importing a Delimited file, choose the type of delimiter (tab, semicolon,

comma, space or other). g. If importing a fixed width file, the lines with arrows between fields signify

the breaks. If they are not correct, click on the break line and then drag it so that it separates the fields from each other. To add an additional break line, click the thin gray bar above the window.

h. If the first row of the text field contains the names of the fields, click the First Row Contains Field Names check box.

i. Click Next. j. Click Finish. 6. If you want to import your data to a new table: a. Click the radio button next to Import the source data into a new table

in the current database. b. Click OK. c. Choose Delimited or Fixed Width. d. Click Next. e. If importing a Delimited file, choose the type of delimiter (tab, semicolon,

comma, space or other). f. If importing a fixed width file, the lines with arrows between fields signify

the breaks. If they are not correct, click on the break line and then drag it so that it separates the fields from each other. To add an additional break line, click the thin gray bar above the window.

g. Click the bar above each field to make any field name, data type or indexing changes.

h. Click the do not import field if you do not wish to import a particular field.

i. Click Next. j. Choose the desired primary key option. If choosing your own primary

key, select the field for which you want to define a primary key from the drop-down list.

k. Click Finish. EVALUATIO

N ONLY

Page 104: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 104

Let’s Try It!

What Why

1. Click the File tab and then click Open.

Displays the Open dialog box.

2. Click the Browse button. Displays the Open dialog box.

3. Click Desktop on the left side of your screen.

Displays the Desktop folder.

4. Double-click the Lesson Files folder.

Opens the Lesson Files folder and displays the files in that folder.

5. Select the Lesson 3 file and then click Open.

Opens the Lesson 3 database.

6. Click the External Data tab on the Ribbon.

Displays the External Data Ribbon.

7. Click the Text File button on the Import & Link group as shown below.

Displays the Get External Data – Text File dialog box.

8. Click the Browse button. Displays the File Open dialog box, from where we will navigate to the folder that contains the text file we want to import.

9. Click Desktop on the left side of your screen and then double-click the Lesson Files folder.

Switches to the folder that contains the file we want to import. EVALU

ATION O

NLY

Page 105: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 105

What Why

10. Select the file named Students and then click the Open button.

Selects the file we want to import and then launches the Import Text Wizard.

11. If necessary, click the radio button next to Import the source data into a new table in the current database.

Specifies that the data will be imported into a new table.

12. Click OK. Displays the Import Text Wizard dialog box.

13. Make sure that Delimited is selected as shown below and then click Next.

Specifies Delimited as the file type and then moves to the next step of the Wizard.

14. Click the Comma radio button as shown below.

Specifies that the fields are separated by a comma delimiter.

EVALUATIO

N ONLY

Page 106: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 106

What Why

15. Click the First Row Contains Field Names check box as shown below.

Specifies that the first row of the text file contains the column headings (or field names).

16. Click Next. We are going to accept the data types for the fields and move to the next step of the Wizard. However, if we were importing data into an existing table, we would want to ensure that the data types matched those of the destination table.

17. Click Next. Moves to the next step of the Wizard.

18. Click Choose my own primary key.

Specifies that we are going to choose which field to set as the primary key field.

19. Select StudentID from the drop-down list as shown below.

Designates StudentID as the primary key field.

EVALUATIO

N ONLY

Page 107: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 107

What Why

20. Click Finish. Imports the data and then displays the Save Import Steps dialog box. If you perform the same import repeatedly, click the Save Import Steps check box and enter a name for your saved import.

21. Click Close. Closes the Save Import Steps dialog box.

22. Double-click the Students table and observe the data.

Opens the new table in Datasheet View.

23. Press the Ctrl + W keystroke combination.

Closes the Students table.

EVALUATIO

N ONLY

Page 108: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 108

3.2 Importing Data from Excel

In this lesson, you will learn how to import data into Access from an Excel Worksheet.

icrosoft Access also allows you to import data from an Excel Worksheet. You will find that the process is very similar to importing a text file. When importing an Excel file, you even have the option of bringing in either an entire worksheet or a specific named range.

Once you have chosen the Excel file that you want to import, the Import Spreadsheet Wizard will step you through the process of importing the worksheet file. Before proceeding however, you will want to ensure that the data in the spreadsheet is arranged in a correct tabular format. If you are appending your data to an existing table, you will want to set the data types the same as the table into which you are importing.

To Import a File from Excel into Access

1. Click the External Data tab on the Ribbon. 2. Click the Excel button on the Import & Link group on the Ribbon. 3. Click the Browse button and then navigate to the folder that contains the

Excel file you want to import. 4. Select the file and then click the Open button. 5. If you want to import your data to an existing table:

M

EVALUATIO

N ONLY

Page 109: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 109

a. Select the radio button next to Append a copy of the records to the table:

b. Choose the table into which you want to import the text file from the drop-down list.

c. Click OK. d. If you are importing an entire worksheet, click the Show Worksheets

radio button and select the worksheet to import. If you are importing a range within a worksheet, click the Show Named Ranges radio button and select the range to import.

e. Click Next. f. Click Finish 6. If you want to import your data to a new table: a. Click the radio button next to Import the source data into a new table

in the current database. b. Click OK. c. If you are importing an entire worksheet, click the Show Worksheets

radio button and select the worksheet to import. If you are importing a range within a worksheet, click the Show Named Ranges radio button and select the range to import.

d. If the first row of the text field contains the names of the fields, select the First Row Contains Field Names box.

e. Click the bar above each field to make any field name, data type or indexing changes.

f. Click the do not import field box if you do not wish to import a particular field.

g. Choose the desired primary key option. If choosing your own primary key, select the field for which you want to define a primary key from the drop-down list.

h. Click Finish.

Let’s Try It!

What Why

1. Click the External Data tab on the Ribbon.

Displays the External Data Ribbon.

2. Click the Excel button on the Import & Link group as shown below.

Displays the Get External Data – Excel Spreadsheet dialog box. EVALU

ATION O

NLY

Page 110: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 110

What Why

3. Click the Browse button. Displays the File Open dialog box, from where we will navigate to the folder that contains the text file we want to import.

4. Click Desktop on the left side of your screen and then double-click the Lesson Files folder on the right side of your screen.

Switches to the folder that contains the file we want to import.

5. Select the file named Classes and then click the Open button.

Selects the file we want to import and then closes the File Open dialog box.

6. Click the radio button next to Append a copy of the records to the table: as shown below.

Specifies that the data will be imported into an existing table.

7. Select tblClasses from the drop-down list as shown above.

Designates the table to which we will append the Excel data. EVALU

ATION O

NLY

Page 111: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 111

What Why

8. Click OK. Launches the Import Spreadsheet Wizard.

9. Ensure that the Show Worksheets button is selected then click Next.

Selects Classes, the only Worksheet in the Workbook and then moves to the next step of the Wizard.

10. Ensure that the First Row Contains Column Headings check box is checked.

Specifies that the first row of the Worksheet contains the column headings. The column headings would be used as Field Names if we were importing to a new table.

11. Click Finish. Imports the data and then displays the Save Import Steps dialog box.

12. Click Close. Closes the Save Import Steps dialog box.

EVALUATIO

N ONLY

Page 112: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 112

3.3 Importing Data from another

Access Database

In this lesson, you will learn how to import data into Access from another Access Database.

mporting data from another Access Database is a matter of selecting the database and then choosing the table you wish to import. In addition to tables, you can also import other Access objects, such as queries, forms and reports.

When importing data from another Access database, you do not have the option of appending the data to an existing table like you have when importing a text file or a spreadsheet. However, once the table is imported, you can then create an Append Query to add the data to an existing table if you so choose.

To Import Data from another Access Database

1. Click the External Data tab on the Ribbon.

I

EVALUATIO

N ONLY

Page 113: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 113

2. Click the Access button on the Import & Link Group on the Ribbon. 3. Click the Browse button and then navigate to the folder that contains the

database from which you want to import data. 4. Select the file and then click the Open button. 5. Ensure that the Import tables, queries, forms, reports, macros and

modules into the current database radio button is selected. 6. Click OK. 7. In the Import Objects dialog box, click the tab for the database object you

want to import. 8. Click the object you want to import. 9. Click OK. 10. Click Close.

Tip: If you want to import just the definitions of the selected tables (the structure only, not the data), click Options, and then under Import Tables, click the Definition Only radio button.

Let’s Try It!

What Why

1. Click the External Data tab on the Ribbon.

Displays the External Data Ribbon.

2. Click the Access button on the Import & Link group as shown below.

Displays the Get External Data – Access Database dialog box.

3. Click the Browse button. Displays the File Open dialog box, from where we will navigate to the folder that contains the Access file we want to import. EVALU

ATION O

NLY

Page 114: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 114

What Why

4. If necessary, click Desktop on the left side of your screen and then navigate to the Lesson Files folder.

Switches to the folder that contains the file we want to import.

5. Select the database file named New Students 2013 and then click the Open button.

Selects the file we want to import.

6. Click OK. Displays the Import Objects dialog box.

7. Click on the Tables tab. Selects the type of object we want to import.

8. Select tblStudentList in the objects window as shown below.

Selects the object that we want to import.

9. Click OK. Imports tblStudentList into our database and displays the Save Import Steps dialog box.

10. Click Close. Closes the Save Import Steps dialog box.

EVALUATIO

N ONLY

Page 115: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 115

3.4 Linking Data

In this lesson, you will learn how to link to data in another database.

inking data allows you to connect to data from another application without having to import it into your database. For example, there may be several departments that use a customer list in their department-specific database. Rather that create several versions of the customers table (as well as updating each

version!), it would make more sense to create one database of customer information and then allow everyone to link to that database. Linking data enables you to read and, in most cases, update data in both the original application and in the current database.

When linking to a table in another database, it is important to keep in mind that any changes you make in the current database will also be made in the source database. In other words, it is a live connection. However, when you delete the icon for a linked table, you are deleting only the link to the table, not the external table itself.

`

To Link to another Database

1. Click the External Data tab on the Ribbon. 2. Click the Access button on the Import & Link Group on the Ribbon. 3. Click the Browse button and then navigate to the folder that contains the

database that you want to link to. 4. Select the file and then click the Open button. 5. Click the Link to the data source by creating a linked table radio button. 6. Click OK. 7. Select the table to which you want to link in the Link Tables window. 8. Click OK.

L

EVALUATIO

N ONLY

Page 116: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 116

9. To remove a linked table, click the linked table in the Navigation Pane and press the Delete key. Click Yes when asked if you want to remove the linked table.

Tip: You can convert a linked table to a non-linked table by selecting the table, clicking the copy button on the Home Ribbon and then clicking the Paste button. Enter a name for the new table. To paste only the table structure (and not the data), click the Structure Only radio button.

Let’s Try It!

What Why

1. Select tblStudents in the Navigation Pane.

Selects the table we want to delete. We are going to delete the students table and then link to the students table that is located in another database.

2. Press the Delete key on your keyboard.

Message box asks you if you really want to delete tblStudents.

3. Click Yes. Opens another message box asking you if you want to delete the relationships for tblStudents. You cannot delete a table until its relationships has been deleted. EVALU

ATION O

NLY

Page 117: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 117

What Why

4. Click Yes. Deletes the relationships for tblStudents and then deletes the tblStudents table.

5. If necessary, click the External Data tab on the Ribbon.

Displays the External Data Ribbon.

6. Click the Access button on the Import & Link group.

Displays the Get External Data – Access Database dialog box.

7. Click the Browse button. Displays the File Open dialog box, from where we will navigate to the folder that contains the database file to which we want to link.

8. If necessary, click Desktop on the left side of your screen and then double-click the Lesson Files folder.

Switches to the folder that contains the file we want to import.

9. Select the database file named Students and then click the Open button.

Selects the file we want to which we want to create a link.

10. Click the Link to the data source by creating a linked table radio button as shown below.

Specifies that we want to create a link to an external table.

EVALUATIO

N ONLY

Page 118: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 118

What Why

11. Click OK. Displays the Link Tables dialog box.

12. Select tblStudents in the Link Tables window as shown below.

Selects the table to which we want to create a link

13. Click OK. Creates a link to tblStudents in the Students database.

14. Observe the icon for the tblStudents.

Notice that the linked table is represented by a right-pointing arrow to the left of the icon.

15. Double-click tblStudents. Opens tblStudents in datasheet view. The data is actually housed in the Students database.

16. Press the Ctrl + W keystroke combination.

Closes tblStudents.

EVALUATIO

N ONLY

Page 119: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 119

3.5 Exporting Data to Other Formats

In this lesson, you will learn how to export data to other file formats.

xporting is a way to save information to another database, spreadsheet or file format so that it can be used by different applications. You can export data to a variety of supported file formats such as Excel, Word, Text Files, ODBC Database, XML, PDF, XPS, and HTML.

In addition to exporting data, you can also export Microsoft Access Objects (tables, queries, forms, reports, macros, and modules) to another Access database.

To Export Data to another Format

1. Select the database object you want to export in the Navigation Pane. 2. Click the External Data tab on the Ribbon. 3. Click the file format to which you want to export on the Export group. For

additional file types, click the More button and select the desired file type. 4. Click the Browse button and navigate to the folder where you want export the

file. 5. Enter a name for the new file and then click Save. 6. Specify any desired export options on the Export dialog box. 7. Click OK. 8. If exporting to the Text File format: a. Select Delimited or Fixed Width in the Export Text Wizard box. b. Click Next. c. If choosing delimited, choose the desired delimiter (i.e. comma, tab, etc.). d. If choosing fixed width, specify the field breaks using the line with arrows. e. Click Finish.

E

EVALUATIO

N ONLY

Page 120: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 120

Let’s Try It!

What Why

1. Click the Navigation Bar and then select Queries from the list.

Switches to Query objects. We are going to export the data from qryRegistration.

2. Select qryRegistration. Selects the query whose data we want to export.

3. If necessary, click the External Data tab on the Ribbon.

Displays the External Data Ribbon.

4. Click the Text File button on the Export group on the Ribbon as shown below.

Displays the Export – Text File dialog box.

5. Click the Browse button. Displays the File Save dialog box from where we select the folder to where we want to export the file.

6. Double-click in the File name box, and then type: Registration_Data

Enters the name for the exported data file.

7. Navigate to the Lesson Files folder on your Desktop if necessary.

Switches to the folder where we want to store the exported data.

8. Click Save. Closes the File Save dialog box.

9. Click OK. Displays the Export Text Wizard dialog box. EVALU

ATION O

NLY

Page 121: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 121

What Why

10. Make sure that Delimited is selected and then click Next.

Specifies Delimited as the text file type then moves to the next step of the Wizard.

11. Select Comma for the delimiter as shown below.

Specifies comma as the delimiter.

12. Click Finish. Exports the data and then displays the Save Import Steps dialog box.

13. Click Close. Closes the Save Import Steps dialog box.

EVALUATIO

N ONLY

Page 122: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 122

3.6 Exporting Data to a PDF File

In this lesson, you will learn how to export data to Portable Document Format.

handy feature in Access is the ability to export your database objects as PDF (Portable Document Format) files. This feature allows you to export any Access object – table, query, form or report – into PDF format while preserving your formatting and layout. This can be quite helpful if you need to send someone

information from your database who does not have Microsoft Access installed on their computer.

Once you export your data, the file will be opened in Adobe Reader, Adobe Acrobat, the Microsoft Edge Web browser or whatever application you have set as the default reader for PDF files.

To Export Data to a PDF File

1. Select the database object you want to export in the Navigation Pane. 2. Click the External Data tab on the Ribbon.

A

EVALUATIO

N ONLY

Page 123: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 123

3. Click the PDF or XPS button on the Export group (XPS - XML Paper Specification - is a Microsoft alternative to PDF file format).

4. Navigate to the folder where you wish to export the data. 5. Type a name for the PDF file in the File Name box. 6. Click either the Standard (publishing online or printing) or Minimum size

(publishing online) radio button. 7. To print only specific pages, click the Options button and enter in the desired

page range. Click OK when finished. 8. If you do not want the file to open after publishing, uncheck the Open file

after publishing box. 9. Click Publish. The document will display in your default PDF viewer

application.

Let’s Try It!

What Why

1. Click the Navigation Bar and then select Reports from the list.

Switches to Report objects. We are going to export the data from rptRegistration.

2. Select rptRegistration. Selects the report whose data we want to export.

3. If necessary, click the External Data tab on the Ribbon.

Displays the External Data Ribbon.

4. Click the PDF or XPS button on the Export group on the Ribbon as shown below.

Displays the Publish as PDF or XPS dialog box.

5. Double-click in the File name box, and then type: Student_Registration

Enters the name for the exported PDF file.

EVALUATIO

N ONLY

Page 124: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 124

What Why

6. Navigate to the Lesson Files folder on your Desktop if necessary.

Switches to the folder where we want to store the exported data.

7. Ensure that the Minimum size (publishing online) radio button is selected.

As we are emailing our file, we want to save it to a smaller file size.

8. Click Publish. Exports the file and displays it in your default PDF file viewer.

9. Press Alt + F4 to close the PDF File Viewer (or Web browser).

Closes the PDF file viewing application.

10. Click the Close button on the Export – PDF window.

Closes the Export – PDF window.

EVALUATIO

N ONLY

Page 125: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 125

3.7 Exporting Data to another

Access Database

In this lesson, you will learn how to export data to another Microsoft Access database.

hen exporting data to another Access database, you will need to export the Table object that contains the data. Choosing a query object will only export the object itself, not the data. So when exporting a query to another Access Database, don’t forget to export the table(s) upon which the query is based as

well.

If you want to export only the data output from a specific query without having to export all of the related tables, the best way to accomplish this is to create a Make-table query and then export the new table.

To Export Data to another Access Database

1. Select the database object you want to export in the Navigation Pane. 2. Click the External Data tab on the Ribbon. 3. Click the Access button on the Export group. 4. Navigate to the folder where the database that is to receive the exported data is

located. 5. Select the database to which you want to export the table.

W

EVALUATIO

N ONLY

Page 126: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 126

6. Click the Save button. 7. Click OK. 8. In the Export dialog box, enter a name for the new table (or accept the current

name). 9. Make sure that the Definition and Data radio button is selected. 10. Click OK.

Let’s Try It!

What Why

1. Click the Navigation Bar and then select Tables from the list.

Switches to Table objects. We are going to export the tblClasses table to another database.

2. Select tblClasses. Selects the table we want to export.

3. If necessary, click the External Data tab on the Ribbon.

Displays the External Data Ribbon.

4. Click Access button on the Export group of the Ribbon as shown below.

Displays the Export – Access Database dialog box.

5. Click the Browse button. Displays the File Save dialog box.

6. Navigate to Lesson Files folder on the Desktop, if necessary.

Switches to the folder where the database that is to receive the data is located.

7. Select New Students 2013 and then click Save.

Selects the New Students 2013 database as the destination database.

8. Click OK. Displays the Export dialog box.

EVALUATIO

N ONLY

Page 127: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 127

What Why

9. Click OK. Accepts the default table name (tblClasses) and then exports the object.

10. Click Close. Closes the Save Export Steps dialog box.

EVALUATIO

N ONLY

Page 128: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 128

3.8 Exporting Data to Excel

In this lesson, you will learn how to export data to an Excel Spreadsheet.

able data can also be exported to an Excel spreadsheet. Once it has been exported, you can then take advantage of Excel’s powerful analytical features and add any formulas, formatting changes, etc.

In older versions of Access, this feature was called “Analyze It with Microsoft Excel”. Since then, the ability to export table or query data to Excel has been added to the Export group on the External Data Ribbon.

To Export Data to Excel

1. Select the table or query object whose data you wish to export to Excel. 2. Click the External Data tab on the Ribbon. 3. Click the Excel button on the Export Ribbon. 4. Click the Browse button and navigate to the folder where you want export the

file. 5. Enter a name for the new file and then click Save. 6. Specify any desired export options on the Export dialog box.

T

EVALUATIO

N ONLY

Page 129: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 129

7. Click OK.

Let’s Try It!

What Why

1. Click the Navigation Bar and then select Queries from the list.

Displays Query objects.

2. Select qryRegistration. Selects the query whose data we want to analyze with Excel.

3. If necessary, click the External Data tab on the Ribbon.

Displays the External Data Ribbon.

4. Click the Excel button on the Export group on the Ribbon as shown below.

Displays the Export – Excel Spreadsheet dialog box.

5. Click the Browse button. Displays the File Save dialog box from where we select the folder where we want to export the file.

6. Double-click in the File name box, and then type: Registration.

Enters the name for the exported data file.

7. Navigate to the Lesson Files folder on the Desktop if necessary.

Switches to the folder where we want to store the exported data.

8. Click Save. Returns us to the Export wizard. EVALUATIO

N ONLY

Page 130: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 130

What Why

9. Click OK. Exports the data and displays the Save Export Steps dialog box.

10. Click Close. Closes the Save Export Steps dialog box.

11. Open the Excel application. Opens the Excel application.

12. Click Open other Workbooks and navigate to the Lesson Files folder on the Desktop.

Navigates to the folder where we saved the Excel spreadsheet.

13. Click the file named Registration and then click Open. Observe the data.

Displays the exported data in Excel.

14. Press the Alt + F4 keystroke combination. Click No if asked to save your changes.

Closes the Excel application.

EVALUATIO

N ONLY

Page 131: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 131

3.9 Exporting Data to Microsoft

Word

In this lesson, you will learn how to export data to a Rich Text Format document.

ou can also take advantage of Microsoft Word’s powerful formatting and layout features by exporting your data to Rich Text Format (.rtf). For instance, you may need to send an Access report electronically to someone who does not have Microsoft Access installed on their computer and needs to be able to edit the data

you send to them.

When exporting a report, the Export Data with Formatting and Layout option is automatically selected in the Export – RTF file dialog box. You can then display the report in Microsoft Word by clicking the Open the destination file after the export is complete option. Then, use the Save As command from within Word to save it in a different format, if need be. The export to Word feature can be used with data from either Tables or Queries.

In older versions of Access, this feature was called “Publish It with Microsoft Word”. Since then, the ability to export data to Word has been added to the Export group on the External Data Ribbon.

Y

EVALUATIO

N ONLY

Page 132: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 132

To Export Data to a Word .RTF Document

1. Click Tables, Queries or Reports from the Navigation Bar. 2. Choose the object whose data you wish to export to Word. 3. Click the External Data tab on the Ribbon. 4. Click the More button on the Export group of the Ribbon. 5. Click the Word button on the Export group. 6. Click Word from the list and then navigate to the folder to where you want

export the file. 7. Enter a name for the new file and then click Save. 8. Specify any desired export options in the Export dialog box. 9. Click OK.

Let’s Try It!

What Why

1. Click the Navigation Bar and then click Reports from the list.

Displays Report objects.

2. Select rptRegistration. Selects the report that we want to export to Word.

3. Click the More button on the Export group as shown below.

Displays a list of available options under the More button.

4. Click Word from the list. Displays the Export – RTF File wizard.

5. Click the Browse button. Displays the File Save dialog box from where we select the folder where we want to export the file. EVALU

ATION O

NLY

Page 133: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 133

What Why

6. Double-click in the File name box, and then type: Registration_Report.

Enters the name for the exported data file.

7. Navigate to the Lesson Files folder on the Desktop if necessary.

Switches to the folder where we want to store the exported data.

8. Click Save. Returns us to the Export Wizard.

9. Click the check box next to Open the destination file after the export operation is complete as shown below.

Sets the option to open the file in Word after the export is completed.

10. Click OK. Exports the file and then displays it in the Word application.

EVALUATIO

N ONLY

Page 134: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 134

What Why

11. Press the Alt + F4 keystroke combination.

Closes the file and exits Word.

12. Click the Close button on the Save Export Steps dialog box.

Closes the Save Export Steps dialog box.

EVALUATIO

N ONLY

Page 135: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 135

3.10 Exporting Data to a Microsoft

Word Mail Merge

In this lesson, you will learn how to export data to a Microsoft Word Mail Merge.

ou can create a Microsoft Word mail merge either from within Word or within Access itself. To initiate a merge, select the table you wish to use as a data source and then click the Word Merge button on the Export group of the External Data Ribbon. You then have the option of using an existing Word document or

creating a new document and linking your data to it.

To Export Data to a Word Mail Merge

1. Click Tables in the Navigation Bar. 2. Click the table you want to use as the data source. 3. Click the External Data tab on the Ribbon. 4. Click the Word Merge button on the Export group on the Ribbon. 5. Choose either Link your data to an existing Microsoft Word document or

Create a new document and then link data to it. 6. Follow the instructions of the Microsoft Word Mail Merge Wizard.

Y

EVALUATIO

N ONLY

Page 136: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 136

Let’s Try It!

What Why

1. Click the Navigation Bar and then click Tables from the list.

Displays Table objects.

2. Select the Students table. Selects the table that we want to use as the source data for our Microsoft Word merge.

3. If necessary, click the External Data tab on the Ribbon.

Displays the External Data Ribbon.

4. Click the Word Merge button on the Export group of the Ribbon as shown below.

Launches the Microsoft Word Mail Merge Wizard dialog box.

5. Click the radio button next to Create a new document and then link the data to it.

Rather than use an existing merge document, we will create a new one.

6. Click OK. Creates a blank merge document using the Students table as the data source.

7. In Word, click the Address Block button on the Write & Insert Fields group as shown below.

Displays the Insert Address Block dialog box.

EVALUATIO

N ONLY

Page 137: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 137

What Why

8. Click the second address format as shown below.

Selects the address format we want to use.

9. Click OK. Inserts the address block and closes the Insert Address Block dialog box.

10. Press the Enter key twice. Inserts two blank lines after the address block.

11. Type Dear as shown below and then press the spacebar.

Types the beginning of our salutation.

12. Click the arrow on the Insert Merge Field button on the Ribbon and then click FirstName as shown below.

Chooses the FirstName field from our Students table. EVALU

ATION O

NLY

Page 138: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 138

What Why

13. Type a comma (,) Enters a comma after the FirstName merge field. From here, you would then type in the text for the rest of your letter.

14. Click the Finish & Merge button on the Ribbon as shown below and choose Edit Individual Documents.

Sets the option to display the completed merge documents in Word.

15. Click OK. Sets the option to merge all of the records from the Students table.

EVALUATIO

N ONLY

Page 139: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 139

What Why

16. Press the Page Down key on your keyboard and observe the document.

Views the completed merge for each record.

17. Press the Alt + F4 keystroke combination. Click Don’t Save when prompted to save your changes.

Closes the merge document without saving your changes.

18. Press the Alt + F4 keystroke combination again. Click Don’t Save when prompted to save your changes.

Closes the Word application without saving your changes.

19. Click the File tab on the Ribbon and choose Close.

Closes the database.

EVALUATIO

N ONLY

Page 140: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 140

Lesson Summary – Importing and

Exporting Data

In this lesson, you learned how to import data from a text file to use in your Access database. You learned that you can import data from either a delimited or a fixed-width file. To import a text file, click the Text File button on the Import & Link group of the External Data Ribbon and follow the instructions of the Wizard.

Then, you learned that Access allows you to import data from an Excel worksheet. When importing an Excel file, you have the option of bringing in either an entire worksheet or a specific named range. You also learned that if you are appending your data to an existing table, you’ll want to set the data types the same as the table into which you are importing. To import data from an Excel spreadsheet, click the Excel button on the Import & Link group of the External Data Ribbon and follow the instructions of the Wizard.

Next, you learned how to import tables and other objects from an Access database. You learned that when importing data from another Access database, you do not have the option to append the data to an existing table like you have when importing a text file or a spreadsheet. To import data from an Access database, click the Access button on the Import & Link group of the External Data Ribbon and follow the instructions of the Wizard.

Next, you learned how to link data; that is to say, connect to data from another application without having to import it into your database. Linking data enables you to read and, in most cases, update data in both the original application and in the current database. To link data from another application, click the button for the application on the Import & Link group of the External Data Ribbon and select the option to link data from the Import Wizard screen.

Next, you learned that exporting data is a way to save information or database objects to another database, spreadsheet or file format so that it can be used by different applications. You learned that you can export data to a variety of supported file formats. To export data, click the desired file format button on the Export group of the External Data Ribbon and follow the instructions of the Wizard.

Next, you learned how to export data to PDF (Portable Document Format) files. This feature allows you to export any Access object – table, query, form or report – into PDF format while preserving your formatting and

EVALUATIO

N ONLY

Page 141: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 141

layout. To export data in PDF format, click the PDF or XPS button on the Export group of the External Data Ribbon.

Next, you worked with exporting data to another Access database. You learned that when exporting database objects such as queries, forms or reports, you will need to export the Table object that contains the data as well. Choosing a query object will only export the object itself, not the data. To export an object to an Access database, select the object, click the Access button on the Export group of the External Data Ribbon and then follow the instructions of the Wizard.

Next, you learned how to export data to Excel. In older versions of Access, this feature was called “Analyze It with Microsoft Excel”. To export data to Excel format, click on the Excel button on the Export group of the External Data Ribbon and follow the instructions of the Wizard.

Next, you learned that you can take advantage of Microsoft Word’s powerful formatting and layout features by exporting your data to Rich Text Format (.rtf). For instance, you may need to send an Access report electronically to someone who does not have Microsoft Access installed on their computer. Click the More button on the Export group on the External Data Ribbon, click Word and then follow the instructions of the Wizard.

Lastly, you learned that you can create a Microsoft Word mail merge either from within Word or within Access itself. To initiate a merge, select the table you wish to use as a data source and then click the Word Merge button on the Export group of the External Data Ribbon. You then have the option of using an existing Word document or creating a new document and linking your data to it.

EVALUATIO

N ONLY

Page 142: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 142

Lesson 3 Quiz

1. What are the two types of plain text data that you can import in Access? A. Fixed Width and Tabbed B. Delimited and Fixed Width C. Comma Separated and Delimited D. Spaced and Tabbed

2. On what Access Ribbon can the command to import and export data be found? A. The Import and Export Ribbon B. The Create Ribbon C. The Database Tools Ribbon D. The External Data Ribbon

3. When importing data into a new table, Access will always automatically choose the primary key field for you.

A. True B. False

4. Before importing Excel data into an existing Access table, what must you first do to the spreadsheet that are you importing?

A. Set the Primary Key Field. B. Sort the Data in Ascending Order. C. Set the Data Types in the spreadsheet the same as the destination table. D. Remove the fields that you do not want to import.

5. When importing data, what options appear on the opening screen of the import wizard (select all that apply)?

A. Import the data to an existing table B. Import the data to a new table C. Import the data as unformatted text D. Link to the data source by creating a linked table

6. How can you distinguish between a linked table and a non-linked table in your Access database?

7. If you select a linked table in your database and press the Delete key: A. All of the data from the linked table and the source table are deleted. B. Access will display a message telling you that the source data must first be deleted

before the linked table can be deleted. C. Only the link to the source file is removed.

EVALUATIO

N ONLY

Page 143: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

© 2016 PCM Courseware, LLC 143

D. The data will automatically be placed in a nonlinked table and then the link will be removed.

8. You can only export table data to another Access database – not queries, reports or forms.

A. True B. False

9. When exporting a query to another database, what also must you also do?

10. The feature to export data to an Excel spreadsheet was called _____________________________________ (fill in the blank) in older versions of Access.

11. When exporting data to a Word document, to what file format will the data be exported? A. Rich Text Format B. Word 2016 C. Plain Text D. Word 2007-2003

12. You want your exported Access Report to automatically display in Word after the export is complete. How can you do this?

13. When exporting data to a Microsoft Word Merge, you can either link your data to an existing Microsoft Word document or create a new document from within Access and then link data to it.

A. True B. False

EVALUATIO

N ONLY

Page 144: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 3 – I M P O R T I N G A N D E X P O R T I N G D A T A

Access 2016 Level 3 144

LAB 3 – ON YOUR OWN

1. Open the Lab3 database in the Lesson Files folder.

2. Import the text file in the Lesson Files folder named New_Products into the tblProducts table. Choose delimited as the file type and choose comma as the delimiter. The first row does not contain column headings.

3. Import the Excel File in the Lesson Files folder named New Customers to a new table. Name the new table tblNewCustomers. Make sure to specify that the first row contains column headings. Choose the CustomerID field as the Primary Key field.

4. Create a link to the Customers database in the Lesson Files folder. Link to the tblCustomers table.

5. Export the table tblProducts to the Customers database.

6. Export tblProducts in Excel format. Save the file as MyProducts in the Lesson Files folder.

7. Export qryCustomers to Microsoft Excel using the Excel Export Wizard. Name the Excel file “Customer List”.

8. Close the Lab3 database.

EVALUATIO

N ONLY

Page 145: Access 2016 – Level 3 EVALUATION2ae3326e66e8cb39cb63-64530cc66300918685e152904e9249e6.r62… · INSTRUCTOR-LED COURSEWARE Access 2016 – Level 3 PCM Courseware, LLC. 6960 N. Ardara

L E S S O N 4 – C R E A T I N G A M E N U S Y S T E M

© 2016 PCM Courseware, LLC 145

Lesson 4 - Creating a Menu System

Lesson Topics:

4.1 Creating a Switchboard

4.2 Adding Switchboard Items

4.3 Using the Switchboard

4.4 Editing a Switchboard

4.5 Setting Startup Options

4.6 Creating a Navigation Form

Lesson

4

EVALUATIO

N ONLY