cover.eps

Teach Yourself VISUALLY™ Access® 2013

Table of Contents

Chapter 1: Getting Started with Access

An Introduction to Access

Start and Exit Access

Create a Blank Database

Create a Database by Using a Template

Open a Database

Close a Database

Understanding the Access Interface

Customize the Quick Access Toolbar

Customize the Ribbon

Change the Navigation Pane View

Open and Close an Object

Change an Object’s View

Chapter 2: Working with Tables

Plan Effective Tables

Create a Table in the Datasheet View

Save a Table

Create a Table in the Design View

Open a Table in the Design View

Rearrange Fields

Insert and Delete Fields

Understanding Data Types

Change a Field’s Data Type

Understanding Primary and Composite Keys

Set the Primary or Composite Key

Rename a Table

Delete a Table

Copy a Table

Chapter 3: Entering and Editing Data

Enter New Records

Navigate between Records

Edit Records

Attach Files to a Record

Open, Save, and Remove File Attachments

Insert an OLE Object

Open, Edit, and Remove OLE Objects

Enter Data in a Multivalued Field

Select Records

Delete Records

Sort Records

Resize Datasheet Columns and Rows

Print a Datasheet or Form

Chapter 4: Working with Fields

Understanding Field Properties

Understanding Field Sizes

Change a Field Size

Set a Field Caption

Set a Field’s Format

Set a Default Value

Make a Field Required

Index a Field

Align Data within a Field

Create an Input Mask

Create a Validation Rule

Create a Record-Level Validation Rule

Chapter 5: Working with Relationships

Understanding Relationships

Create a Relationship between Two Tables

Edit a Relationship

Remove a Relationship

Arrange the Relationships Window

Print a Relationship Report

View Object Dependencies

Document the Database

Understanding Lookups

Create a Table for Use As a Field Lookup

Create a Field Lookup Based on a Table

Create a Field Lookup with Values That You Specify

Set Up a Multivalued Field

Chapter 6: Finding and Filtering Data

Understanding Find and Replace

Find Data

Replace Data

Filter to Show Only Blank or Nonblank Entries

Filter by Selection

Filter for Multiple Values

Using Text Filters

Filter by Form

Save a Filter As a Query

Chapter 7: Creating Simple Queries

Understanding Queries

Create a Query with the Simple Query Wizard

Start a New Query in the Query Design View

Insert, Arrange, and Remove Query Fields

Set Field Sorting

Add an Alias to a Query Field

Understanding Criteria

Filter a Query for a Specific Value

Specify a Range of Values

Specify a List of Values

Hide a Field in the Query Results

Create Compound Criteria

Limit the Records Returned

Chapter 8: Creating Complex Queries

Understanding Summary Queries

Create a Summary Query with the Simple Query Wizard

Create a Summary Query in the Query Design View

Understanding Calculated Fields

Create a Calculated Field

Understanding Action Queries

Run a Make Table Query

Run a Delete Query

Run an Append Query

Run an Update Query

Prompt the User for a Parameter

Understanding Parameter Syntax

Chapter 9: Creating Forms

Understanding Forms

Create and Save a Form

Create a Form with the Form Wizard

Create a Form in the Layout View

Create a Form in the Design View

Delete a Field from the Design View

Arrange Fields on a Form

Group Fields Together

Define the Tab Order on a Form

Chapter 10: Editing Forms

Display the Header and Footer

Resize Sections of a Form

Select Sections of a Form

Add a Form Title

Apply a Theme

Browse for a Theme to Apply

Apply a Font Theme or Color Theme

Create a Custom Font Theme

Create a Custom Color Theme

Create a Custom Theme

Adjust Internal Margins and Padding

Add a Label

Format Label Text

Change the Background Color

Add a Background Image

Add a Hyperlink

Add a Tabbed Section

Insert a Logo or an Image

Set Conditional Formatting

Chapter 11: Creating Reports

Understanding Report Views

Create a Simple Report

Apply a Theme to a Report

Preview and Print a Report

Create a Report with the Report Wizard

Create a Report in the Layout View

Set the Page Size and Orientation

Change the Report Layout Type

Set Page Margins

Set Control Margins and Padding

Format Report Text

Size and Align Report Fields

Insert a Page-Numbering Code

Chapter 12: Grouping and Sorting Data

Understanding Grouping and Summarizing

Group Report Results

Group a Numeric Field by Intervals

Group a Date Field

Group Records Using an Expression

Sort Report Results

Count Records

Add an Aggregate Function

Hide the Group Header and Footer

Keep a Group Together on a Page

Change the Grouping or Sorting Priority

Remove a Grouping or Sorting

Chapter 13: Creating Mailing Labels

Create Labels

Add a Field to an Existing Line

Add a Field to a Label As a Separate Line

Color the Label Background

Color the Label Text

Apply Font Formatting to the Label Text

Export Labels to Word

Chapter 14: Performing a Mail Merge

Start a Mail Merge

Create the Main Document in Word

Insert an Address Block

Insert a Greeting Line

Match Fields

Insert Individual Fields

Preview the Merge Results

Filter the Recipient List

Sort the Recipient List

Merge to a New Document

Merge Directly to a Printer

Save the Merge for Later Use

Chapter 15: Working with External Data

Import an Excel Worksheet

Link to an Excel Worksheet

Link to an Outlook Folder

Manage Linked Tables

Import a Table from Another Access Database

Import Data from a Delimited Text File

Import Data from a Web Page

Import Data from an XML File

Export Data to Excel

Export Data As HTML

Export Data to a Plain Text File

Save Import or Export Specifications

Using Saved Import or Export Specifications

Analyze Access Data Using an Excel PivotTable

Add Multiple Fields to a PivotTable Area

Move a Field to a Different PivotTable Area

Group PivotTable Values

Apply a PivotTable Filter

Chapter 16: Maintaining a Database

Set a Trusted Location

Save in an Earlier Version Format

Convert to the Access 2007-2013 Format

Back Up a Database

Analyze Database Performance

Compact and Repair a Database

Password-Protect a Database

Create a Switchboard

Set Switchboard Startup Options

titlepg.png

Trademark Acknowledgments

Contact Us

WileycopyrightLogo_fmt.jpeg

Sales | Contact Wiley at (877) 762-2974 or fax (317) 572-4002.

Credits

Executive Editor

Jody Lefevere

Project Editor

Dana Rhodes Lesh

Technical Editor

Vince Averello

Copy Editor

Dana Rhodes Lesh

Editorial Director

Robyn Siesky

Business Manager

Amy Knies

Senior Marketing Manager

Sandy Smith

Vice President and Executive Group Publisher

Richard Swadley

Vice President and Executive Publisher

Barry Pruett

Project Coordinator

Katie Crocker

Graphics and Production Specialists

Ana Carrillo
Joyce Haughey
Andrea Hornberger
Jennifer Mayberry

Quality Control Technician

Lauren Mandelbaum

Proofreading and Indexing

Cynthia Fields
BIM Indexing & Proofreading Services

About the Author

Paul McFedries is a full-time technical writer. Paul has been authoring computer books since 1991 and has more than 80 books to his credit. His books have sold more than four million copies worldwide. These books include the Wiley titles Teach Yourself VISUALLY Microsoft Excel 2013, Teach Yourself VISUALLY Microsoft Windows 8, Windows 8 Visual Quick Tips, iPhone 5 Portable Genius, and iPad 4th Generation and iPad mini Portable Genius. Paul is also the proprietor of Word Spy (www.wordspy.com), a website that tracks new words and phrases as they enter the language. Paul invites you to drop by his personal website at www.mcfedries.com or follow him on Twitter at @paulmcf and @wordspy.

Author’s Acknowledgments

It goes without saying that writers focus on text, and I certainly enjoyed focusing on the text that you will read in this book. However, this book is more than just the usual collection of words and phrases. A quick thumb through the pages will show you that this book is also chock-full of images, including sharp screenshots. Those colorful images make for a beautiful book, and that beauty comes from a lot of hard work by Wiley’s immensely talented group of designers and layout artists. They are all listed in the Credits section on the previous page, and I thank them for creating another gem. Of course, what you read in this book must also be accurate, logically presented, and free of errors. Ensuring all of this was an excellent group of editors that included project editor and copy editor Dana Lesh and technical editor Vince Averello. Thanks for your exceptional competence and hard work. Thanks, as well, to Wiley executive editor Jody Lefevere for asking me to write this book.

How to Use This Book

Whom This Book Is For

This book is for the reader who has never used Microsoft Access. It is also for readers who want to expand their knowledge of Access and learn about the features of the latest version.

The Conventions in This Book

001 Steps

This book uses a step-by-step format to guide you easily through each task. Numbered steps are actions you must perform; bulleted steps clarify a point, step, or optional feature; and indented steps give you the result.

002 Notes

Notes give additional information — special conditions that may occur during an operation, a situation that you want to avoid, or a cross-reference to a related area of the book.

003 Icons and Buttons

Icons and buttons show you exactly what you need to click to perform a step.

004 Tips

Tips offer additional information, including warnings and shortcuts.

005 Bold

Bold type shows command names or options that you must click and text or numbers you must type.

006 Italics

Italic type introduces and defines a new term.

9781118517703-fm01.eps

Chapter 1: Getting Started with Access

Are you new to Microsoft Access or upgrading to the latest version of the program? This chapter introduces you to Access and to some useful database concepts. You also learn how to create and open a database as well as how to navigate through the Access interface.

9781118517703-co0101.tif

An Introduction to Access

Start and Exit Access

Create a Blank Database

Create a Database by Using a Template

Open a Database

Close a Database

Understanding the Access Interface

Customize the Quick Access Toolbar

Customize the Ribbon

Change the Navigation Pane View

Open and Close an Object

Change an Object’s View

An Introduction to Access

Microsoft Access is a program for creating and working with special files called databases, which are designed to store collections of related information. For example, one database might store business data such as customers, invoices, and inventory, whereas another might store personal data such as contacts, movies, and household items. You can use Access to create, retrieve, and manage large or small collections of information.

To get the most out of Access, you need to understand basic concepts such as tables, records, and fields; database objects such as datasheets and forms; and database tools such as filters, queries, and reports.

Tables, Records, and Fields

9781118517703-fg0101.eps

In Access, data is stored in tables, and each individual entry in a table is called a record. For example, in a Customers table, the information about each customer is a separate record. Each record is composed of one or more fields that contain individual pieces of data. In this example, customer fields may include Name, Address, City, State, and Zip Code.

Datasheets and Forms

9781118517703-fg0102.eps

By default, each table appears as a spreadsheet grid called a datasheet. You can type directly into a datasheet. To make data entry more convenient, some people choose to create on-screen forms, which are like dialog boxes that prompt for field entries. An attractively formatted form is easier and more pleasant to use to enter new records than a plain datasheet.

Filters and Queries

9781118517703-fg0103.eps

It is often useful to display a filtered view of a table. You can filter a table to show only certain records, only certain fields, or both. You can run a one-time filter, or you can create a query, which is like a saved filter. Queries also enable you to combine data from multiple related tables into a single datasheet of results.

Reports

9781118517703-fg0104.eps

Tables and query results appear in plain datasheets, which are not very attractive when printed. Reports present data from tables and queries in an attractive, customizable format — complete with titles, headers and footers, and even logos and graphics.

Relational Databases

9781118517703-fg0105.eps

Microsoft Access creates relational databases — that is, databases that can contain multiple tables with links between them. For example, a business may have a Customers table for storing customer contact information and an Orders table for storing information about orders placed. Each customer in the Customers table has a unique ID, and each order in the Orders table references a specific customer ID.

Start and Exit Access

Before you can create or open a database file, you must first start Access. This brings the Access window onto the Windows desktop so that you can then begin using the program.

How you start Access depends on which version of Windows you are using. In this section, you learn how to start Access 2013 in Windows 8 and in Windows 7. When you are finished working with Access, you should exit the program.

Start and Exit Access

Start Access in Windows 8

9781118517703-fg0106.eps

001 On the Windows 8 Start screen, click Access 2013.

The Microsoft Access window appears on the desktop.

Start Access in Windows 7

9781118517703-fg0107.eps

001 Click Start.

002 Click All Programs.

9781118517703-fg0108.eps

003 Click Microsoft Office 2013.

004 Click Access 2013.

The Microsoft Access window appears on the desktop.

Exit Access

9781118517703-fg0109.eps

001 Right-click the Access taskbar button (9781118517703-ma006.tif).

002 Click Close window.

Note: If you have two or more database files open, click Close all windows instead.

Access closes, returning you to your desktop view.

Create a Blank Database

The simplest way to get started with Microsoft Access is to create a blank database. A blank database contains only a single, empty table and no other database objects, such as queries, forms, or reports. A blank database provides the freedom to create exactly the objects that you want for your project.

If another person or your company has provided you with a database file, you should open that file instead; see the section “Open a Database.”

Create a Blank Database

9781118517703-fg0110.eps

001 Click File.

Note: If you have just started Access, skip to step 3.

The File options appear.

9781118517703-fg0111.eps

002 Click New.

The New options appear.

003 Click Blank desktop database.

The Blank Desktop Database dialog box appears.

9781118517703-fg0112.eps

004 Type a filename for the database.

005 Click Create.

9781118517703-fg0113.eps

A A new database opens, with a new blank table started.

Create a Database by Using a Template

Rather than start from scratch with a blank database, you can get your database project off the ground easier and faster by creating a new database based on a template.

A template is a special file that includes prefabricated database objects that you can use right away. For example, a contact management template might include a table with fields such as Name, Address, and Phone, as well as a form for entering data and a report that organizes the contacts into an address book. With a template, all you do is fill in the data, and Access does the rest.

Create a Database by Using a Template

001 Start Microsoft Access.

Note: If Access is already running, click File and then click New instead.

9781118517703-fg0114.eps

002 Type a word that describes the type of database you want to create.

A You can also click any of these suggested template search terms.

B You can also click one of these Microsoft-supplied templates that are stored on your computer and then skip to step 5.

003 Press ent.eps.

The search results appear.

9781118517703-fg0115.eps

004 Click the template that best matches your needs.

A dialog box for that template appears.

9781118517703-fg0116.eps

005 Type a name for the database file.

006 Click Create.

9781118517703-fg0117.tif

If you chose an online template, it is downloaded from the Internet.

The database opens. Its appearance depends on the template that you chose.

Open a Database

If you have created multiple databases, you can open a database that you previously created to continue developing its structure, type data in it, or analyze its data.

Your database files will most often be stored on your computer’s hard drive. However, it is also possible to open databases from your network or from the online SkyDrive storage area associated with your Microsoft account.

Open a Database

001 Start Microsoft Access.

002 Click Open Other Files.

Note: If Access is already running and you have another database open, click File instead.

The File options appear.

9781118517703-fg0118.eps

003 Click Open.

The Open options appear.

A If you opened the database recently, you can also click Recent and then click the database. In this case, you can skip the rest of the steps in this section.

004 Click Computer.

005 Click Browse.

The Open dialog box appears.

9781118517703-fg0119.eps

B If necessary, you can navigate to a different location.

006 Click the database that you want to open.

007 Click Open.

Access opens the database.

Close a Database

When you have finished your work with an Access database, you should close the file. You can have multiple databases open at once, each in its own copy of the application, but closing a database when you are finished with it frees up your computer’s memory.

When you close a database, Access checks to see whether any open objects have unsaved changes. If Access detects an object that has unsaved changes, it prompts you to save it. This is a very important step because it prevents you from losing work, so be sure to save your changes when and if Access prompts you.

Close a Database

9781118517703-fg0120.eps

001 Click File.

The File options appear.

9781118517703-fg0121.eps

002 Click Close.

A You can also close a database by clicking the Close button (9781118517703-ma005.tif).

Access closes the database.

Note: If Access prompts you to save an object, click Yes.

Understanding the Access Interface

Access 2013 has a user interface consistent with those of other Office 2013 applications, including Word and Excel. It contains tabs, a multiple-tabbed Ribbon, and a status bar.

9781118517703-fg0122.eps

A File

Displays a menu of file commands.

B Quick Access Toolbar

Provides shortcuts to commonly used features. This toolbar is customizable.

C Tabs

Contain buttons and other controls for working with data.

D Ribbon

Displays and organizes tabs.

E Dialog box launcher

Clicking this icon (9781118517703-ma008.tif) opens a dialog box related to the group.

F Groups

Organize controls into sections within tabs.

9781118517703-fg0123.eps

A Object tabs

Provide access to all open database objects, such as tables, reports, and forms.

B Scroll bars

Enable you to scroll through a datasheet.

C View buttons

Switch between various views of the selected object. The buttons are different depending on what type of object is active. Hover over a button to find out which view each button represents.

D Record selector

Displays the current record number and enables you to navigate to other records.

E Status bar

Displays information about the current object or view.

F The Navigation pane

Lists all available database objects.

Customize the Quick Access Toolbar

You can make Access easier to use by customizing the Quick Access Toolbar to include the Access commands that you use most often. You run Quick Access Toolbar commands with a single click, so adding your favorite commands saves time because you no longer have to search for and click a command on the Ribbon.

By default, the Quick Access Toolbar contains three buttons: Save, Undo, and Redo. You can add common commands such as New and Open to the Quick Access Toolbar, as well as hundreds of other Access commands.

Customize the Quick Access Toolbar

9781118517703-fg0124.eps

001 Click the Customize Quick Access Toolbar button (9781118517703-ma011.tif).

A If you see the command that you want, click it and skip the rest of the steps in this section.

002 Click More Commands.

The Access Options dialog box appears.

9781118517703-fg0125.eps

B Access automatically displays the Quick Access Toolbar tab.

003 Click the Choose commands from 9781118517703-ma010.tif.

004 Click the command category that you want to use.

9781118517703-fg0126.eps

005 Click the command that you want to add.

006 Click Add.

C Access adds the command.

D To remove a command, click it and then click Remove.

007 Click OK.

Access tells you to close and reopen the database for the change to take effect.

9781118517703-fg0127.eps

008 Click OK.

E Access adds a button for the command to the Quick Access Toolbar.

Note: You do not need to close and then reopen the database.

Note: Another way to remove a command is to right-click the command and then click Remove from Quick Access Toolbar.

Customize the Ribbon

You can improve your Access productivity by customizing the Ribbon with extra commands that you use frequently. The Ribbon is a handy tool because it enables you to run Access commands with just a few clicks of the mouse. However, the Ribbon does not include every Access command. If there is a command that you use often, you should add it to the Ribbon for easy access.

To add a new command to the Ribbon, you must first create a new tab or a new group within an existing tab and then add the command to the new tab or group.

Customize the Ribbon

Display the Customize Ribbon Tab

9781118517703-fg0128.eps

001 Right-click any part of the Ribbon.

002 Click Customize the Ribbon.

The Access Options dialog box appears.

9781118517703-fg0129.eps

A Access automatically displays the Customize Ribbon tab.

Add a New Tab or Group

003 Click the tab that you want to customize.

B You can also click New Tab to create a custom tab.

004 Click New Group.

C Access adds the group.

005 Click Rename.

The Rename dialog box appears.

006 Type a name for the group.

007 Click OK.

Add a Command

9781118517703-fg0130.eps

008 Click the Choose commands from 9781118517703-ma010.tif.

009 Click the command category that you want to use.

010 Click the command that you want to add.

011 Click the custom group or tab that you want to use.

012 Click Add.

D Access adds the command.

E To remove a custom command, click it and then click Remove.

013 Click OK.

Access tells you to close and reopen the database for the change to take effect.

9781118517703-fg0131.eps

014 Click OK.

F Access adds the new group and command to the Ribbon.

Note: You do not need to close and then reopen the database.

Change the Navigation Pane View

The Navigation pane on the left side of the database window presents a list of all the objects in the database, including its tables, queries, forms, and reports. This is an important element of the Access interface because it enables you to view and manage the objects, so you should set up the Navigation pane to suit the way that you work.

If you need more horizontal room to work on a table or form, you can hide the Navigation pane. You can also adjust the width of the Navigation pane as well as change the way it sorts and lists objects.

Change the Navigation Pane View

Hide the Navigation Pane

9781118517703-fg0132.eps

001 If the Navigation pane is displayed, click 9781118517703-ma012.tif.

Access hides the Navigation pane.

Display the Navigation Pane

9781118517703-fg0133.eps

001 If the Navigation pane is hidden, click 9781118517703-ma013.tif.

Access displays the Navigation pane.

Adjust the Navigation Pane Size

9781118517703-fg0134.eps

001 Drag the border to the left or right (9781118517703-ma009.tif changes to 9781118517703-ma014.eps).

A A black line shows the new position for the border.

Change the Way Objects Are Displayed

9781118517703-fg0135.eps

001 Click 9781118517703-ma015.tif.

A menu of object options opens.

002 Click the way that you want to view the object list.

B You can also filter the list to show only a certain type of object.

C You can choose All Access Objects to return to the full list after filtering.

Open and Close an Object

You perform work in Microsoft Access by manipulating database objects such as tables, queries, and forms. Before you can work on an object, you must open it. You can open any available database object from the Navigation pane. The object appears in the main window to the right of the Navigation pane; from there, you can work with the object’s content. You can open multiple objects at the same time and then switch among them.

When you no longer need to work with an object, you should close it to reduce clutter in the main database window.

Open and Close an Object

Open an Object

9781118517703-fg0136.eps

001 If necessary, click the category’s 9781118517703-ma016.tif icon to expand it.

002 Double-click the object.

A The object appears in the database window.

B Access displays a tab for the object.

C To switch among open objects, click the tab of the object that you want.

Close an Object

9781118517703-fg0137.eps

001 Click the tab of the object that you want to close.

002 Click 9781118517703-ma005.tif.

Note: You can also right-click the object’s tab and then click Close.

The object closes.

Change an Object’s View

Access offers you multiple ways to interact with each database object. For example, with a table, you can work either with the data, including adding, editing, and deleting records, or you can work with the table structure, including adding, editing, and deleting fields. To switch between these different ways of interacting with a database object, you change the object’s view.

The available views depend on the object type but usually include a view for using the object, such as the Datasheet view, and a view for modifying the object, such as the Design view.

Change an Object’s View

Select a View from the Ribbon

9781118517703-fg0138.eps

001 Click the Home tab.

002 Click the View 9781118517703-ma007.tif.

003 Click the view that you want to use.

Note: You can also right-click an object’s tab and then click the view that you want from the shortcut menu.

Select a View by Using the View Buttons

9781118517703-fg0139.eps

001 In the status bar, click the button for the view that you want.

Note: The buttons that are available change depending on the object type.

A To determine which view a button represents, move 9781118517703-ma009.tif over the button to see a screen tip.