Você está na página 1de 180

Access 2000: Level 1 (First Edition)

Student Manual

Access 2000: Level 1 (First Edition)

While Ziff-Davis Education takes great care to ensure the accuracy and quality of these materials, all material is provided without any warranty whatsoever, including, but not limited to, the implied warranties of merchantability or fitness for a particular purpose. Trademark Notices: Ziff-Davis Education, Logical Operations, the Ziff-Davis Education and Logical Operations logos, ActiveLearn, and ExpressLine are trademarks and service marks of Ziff-Davis Inc. All product names and services identified throughout this book are trademarks or registered trademarks of their respective companies. The product names and services are used throughout this book in editorial fashion only and for the benefit of such companies. No such use, or the use of any trade name, is intended to convey endorsement or other affiliation with the book. Some of the images contained in this book may be from the Corel GALLERY 2 Software or from Double Exposure, and are used with permission. Contact Double Exposure at doubleexposure@hookup.com. Copyright 2000 Ziff-Davis Education, a division of Ziff-Davis Inc. All rights reserved. This publication, or any part thereof, may not be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, storage in an information retrieval system, or otherwise, without the prior written permission of Ziff-Davis Education, 500 Canal View Boulevard, Rochester, NY 14623 (716) 240-7500, (800) 434-3466. Ziff-Davis Educations World Wide Web site is located at http://www.zdeducation.com

O N T E N T S

Introduction

Using this manual ...............................................................................................iii

Lesson 1: Overview of Access 2000

A. Introduction to database concepts and terminology............................................1-2 B. An introduction to Access 2000.........................................................................1-6 C. Database planning and design..........................................................................1-19 Wrap-up for Lesson 1............................................................................................1-24

Lesson 2: Creating tables

A. Examining a table ...........................................................................................2-2 B. Creating a table with the Table Wizard............................................................2-9 C. Creating a table in Design View .......................................................................2-13 D. Types of primary keys .....................................................................................2-21 Practice Unit for Lesson 2 ....................................................................................2-23 Wrap-up for Lesson 2............................................................................................2-24

Lesson 3: Working with tables

A. Adding records ................................................................................................3-2 B. Modifying the table design ...............................................................................3-5 C. Finding and editing records .............................................................................3-9 D. Deleting, adding, and copying records and values..............................................3-14 E. Filtering and sorting records............................................................................3-17 Practice Unit for Lesson 3 ....................................................................................3-20 Wrap-up for Lesson 3............................................................................................3-21

Lesson 4: Using select queries

A. Selecting fields and sorting records...................................................................4-2 B. Refining the results of a query .........................................................................4-10 C. Using queries to perform calculations...............................................................4-18 D. Joining tables in a query..................................................................................4-23 Practice Unit for Lesson 4 ....................................................................................4-26 Wrap-up for Lesson 4............................................................................................4-27

Lesson 5: Creating and using forms

A. Creating a form...............................................................................................5-2 B. Modifying the form design................................................................................5-7 C. Using a form to locate and organize information ...............................................5-15 D. Multiple-table forms ........................................................................................5-18 Practice Unit for Lesson 5 ....................................................................................5-21 Wrap-up for Lesson 5............................................................................................5-22

Lesson 6: Creating and using reports

A. Creating a report.............................................................................................6-2 B. Creating a report that contains totals...............................................................6-8 Practice Unit for Lesson 6 ....................................................................................6-14 Wrap-up for Lesson 6............................................................................................6-15
i

Access 2000: Level 1 (First Edition)

Lesson 7: Creating and maintaining a database

A. Creating a database.........................................................................................7-2 B. Managing a database and its objects.................................................................7-4 C. Database maintenance.....................................................................................7-7 Wrap-up for Lesson 7............................................................................................7-10

Appendix A: Data Access Pages ................................................................................A-1


A. Data Access Pages...........................................................................................A-2

Reference section

Solutions..............................................................................................................R-2 Quick Reference ...................................................................................................R-14 Glossary...............................................................................................................R-18

Index .......................................................................................................................I-1

ii

N T R O D U C T I O N

Welcome to the Access 2000: Level 1 (First Edition) course. In this Introduction, you'll find information on how to use this manual and the accompanying data disk.

Using this manual


Because we believe that teaching concepts is just as important as teaching procedures, we start each topic with the "big picture"that is, we introduce a feature or provide background information. Then we present details and procedures in small, easy-to-absorb segments. Because we also believe that people generally learn best by doing, most of your coursework consists of guided hands-on activities at the computer. This teaching philosophy is also reflected in the way we organize the material in this manual.

What you'll find in this manual


A table of contents This introduction Lessons containing objectives, explanations, guided hands-on activities, independent practice activities, and wrap-ups Solutions for wrap-up and minds-on activities A keystroke and (if applicable) icon reference A glossary of terms used in this course An index A data disk

How to interpret conventions used in this manual


Tasks are written in a two-column format.

In the left column ("What you do"), numbered steps list task instructions. In the right column ("Comments/Prompts"), comments describe the results of, or reasons for, the steps listed on the left, and prompts display the program's requests for information.

iii

Access 2000: Level 1 (First Edition)

The following table describes how various items are represented in the left column of tasks in this manual.

Typographical convention
_reversed_type_ _reversed_ _reversed_

What it represents
Menu command that you choose Menu commands that you choose sequentially Keys that you press

Key in box Boxed Key

Boxed Key

Keys that you press together (while holding down the first key, press the second key; then release both) Keys that you press in sequence (press End, then press Home) An icon or tool that you click on Characters that you select or type Options that you select in dialog boxes or list boxes Buttons that you click on

Boxed Key

Boxed Key

Small picture
Boldface type

How this manual can help you learn both during and after class
Your Student Manual and its accompanying data disk serve three purposes for youlearning, review, and referenceso you can continue learning even after you complete the course.
Learning: During class, you will use the manual and data disk as you complete

a series of hands-on tasks that focus on specific techniques and skills needed to effectively use a program at a certain level.
Review: You can use the manual and data disk to review material you learned

in class. By the end of the class, the disk might contain not only the original data files, but also the files you have worked on and saved with different names (usually starting with "my").
Reference: You can use the Concepts sections in the manual as a first source

for definitions of terms, background information on given topics, and summaries of procedures. Use the table of contents, the lesson objectives listed at the beginning of each lesson, and the index to help you find the specific information you are seeking.

iv

Overview of Access 2000

Lesson objectives
To acquire the skills necessary to create and use an Access database, you will: a Discuss database concepts and terminology. b Become familiar with the Access environment and learn the names and functions of various Access objects.

c Learn database design principles.

1-1

Access 2000: Level 1 (First Edition)

a
Concepts >

Introduction to database concepts and terminology


What is a database
A database is a collection of related information, or data. Common examples of databases include phone books, mailing lists, dictionaries, card catalogs, recipe books, medical records, inventory lists, sales orders, personnel records, or population statistics.

Task A-1: Identifying collections of data


What you do
1. What are some examples of collections of data that you use at your workplace? What are some examples of collections of data that you use in your personal life? List other examples of collections of data that you encounter daily.

Comments/Prompts
________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________

2.

3.

Electronic database-management systems


Concepts > In dealing with collections of information, you might find working with a manual filing system disadvantageous, particularly if the data collection is large. Depending upon the medium (paper or microfiche, for example) the database information might be awkward to organize or difficult to extract. In contrast, electronic databases manage large collections of information easily. Access 2000 is an electronic relational database-management system for Windows. It enables you to electronically store, organize, and manipulate collections of information:

Sorting: You can rearrange information in different ways (alphabetic or numeric order, and so forth). For example, a sorted employee roster from a companys personnel database might list all employees according to their hire date. Extracting: You can extract specific information and view it, work with it, or print it. For example, from a companys personnel database, you might want to extract a list of employees and their salaries for one department. Summarizing: You can manipulate and summarize information. For example, from a companys personnel database, you might want to report employee hours and rates, grouped by department, with totals and averages for each department and for the entire company.

1-2

Lesson 1: Overview of Access 2000

Task A-2: An introduction to database concepts


q Objective: To examine the value of a database-management system for managing data.

What you do
1. Suppose you are working with a set of employee information forms that are stored in a filing cabinet. How would you do each of the following activities, working with a paper database? a. b. c. d. 2. Sort the forms by city List only names and extensions Search for a specific name List only those people who live in California

Comments/Prompts
________________________________________ ________________________________________

Once information is stored in an electronic database, you can view specific information depending on your needs. List types of information you could extract from: a. a check book ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________

b. c.

the Department of Motor Vehicles a database at your workplace

1-3

Access 2000: Level 1 (First Edition)

Database terminology
Concepts > The way the information is organized in a database makes it possible to extract and manipulate data with ease and flexibility. Data-storage terminology common to relational database-management systems includes the following: Data value: one item of data. For example, a phone number. Record: A single set of related data values. For example, the first name, last name, address, and telephone number for one person listed in an address book. Field: A category of information within a set of records. For example, the last names, first names, addresses, or phone numbers of the people listed in an address book. Table: A group of records collected and stored in rows and columns. Database: One or more tables of data related to a particular purpose, and the tools for using the data. A database is analogous to a container that holds all the parts of a project. For example, your company might have a sales database and a personnel database that hold all the data relating to either sales or personnel. Access 2000 is a relational database-management system; with it, you can store data in separate tables, yet display related data together in one table.

Figure 1-1: Employee directory sample paper table. a

1-4

Lesson 1: Overview of Access 2000

Task A-3: Identifying tables, records, and fields


What you do
1. Observe Figure 1-1

Comments/Prompts
It is an example of a table. The table is a list of related information (addresses and phone extensions for employees). Each column contains a category of information. Each row contains a unit of information for one person. ________________________________________ ________________________________________ ________________________________________

2. 3. 4.

What is the topic of the table? What is the term for a row of data in a table? What is the term for a column of data in a table?

1-5

Access 2000: Level 1 (First Edition)

b
whats new

An introduction to Access 2000


The following new software features are discussed in this topic:

Improved Help system Redesigned File Management dialog box (File, Open) Redesigned menu system Improved Database window

Access objects
Concepts > In Access, databases consist not only of data, but also of objects by which you work with the data. An Access database can consist of such objects as tables, forms, queries, reports, pages, macros, and modules. A Table object enables you to store a collection of related information in a rectangular arrangement of rows and columns. Tables must be designed properly and created first because they are the foundation of all the other objects in the databaseforms, reports, and queries, for example. A Form object enables you to enter and view information in a table or query. Forms are custom designedsometimes they display all the fields of a record, sometimes they might display only a few. A form displays data from the table it is based on. Because forms are often used for entering data, they enable you to focus on the record you want to enter or edit without the distraction of seeing other records. Forms can be simple (just to get the data into the database) or customized and enhanced to make working with the data easier for you (using a database to answer customer service requests). A Query object enables you to ask questions of, analyze, and locate data stored in tables. With a query, you can locate certain pieces of information contained in a particular field, a set of records, or both. You can also analyze trends by sorting, calculating, and summarizing data obtained with queries. A Report object enables you to analyze and print data in a specific format. Although you can print a table or form, a report gives you greater control over the format of the printed output. You can create a report from a table or a query. Within a report, you can print some or all of a tables (or querys) fields and records, as well as summary information. A Page object enables you to build Access forms and reports that run in your Web browser.

1-6

Lesson 1: Overview of Access 2000

Source data

tables

sets of related data

Objects that use data stored in tables forms


customized view of a record or records

queries
data resulting from questions you ask of a table

reports
printed output (might contain group summary information)

Figure 1-2: A database.

Task B-1: Identifying Access objects


q Objective: To review Access-specific terminology.

What you do
1. Match the terms on the right with the descriptions on the left A. An object that stores a list of related information. B. An object for storing a customized view of data. C. Components that make up a database. D. A group of tables containing related information and tools to use it. E. An object for storing questions. F. An object for storing the design of a printed database 2. Within a database, which objects do you create first?

Comments/Prompts

__________ Objects __________ Query __________ Database __________ Report

__________ Form __________ Table

________________________________________

1-7

Access 2000: Level 1 (First Edition)

Starting Access
Concepts > To use Access, you must load the program from the hard disk into the computers memory (RAM). The executable file for the Access application is installed in C:\Program Files\Microsoft Office\Office. Access 2000 runs with Microsoft Windows 95, Windows 98, or Windows NT 4.0. To start the Access program, click on the Start button in the taskbar, and choose Programs, Microsoft Access.

The Office Assistant


When you start Access 2000, the Office Assistant is displayed. The Office Assistant is an animated online help system that provides help topics and tips while you work. This Help feature is shared by all the Office programs. To search for help information click on the Office Assistant to display the What Would You Like To Do dialog box. Type the topic name for which you want to search. Click on Search. To change the Office Assistant options: 1. 2. 3. 4. 5. Click on the Office Assistant. Click on Options to display the Office Assistant dialog box. Select the Options tab, if necessary. Check or uncheck the desired options. Click on OK.

If you want to hide the Office Assistant, choose the Help menu and select Hide The Office Assistant. To display the Office Assistant, on the Standard toolbar, click on the Microsoft Access Help button or choose Help, Show The Office Assistant. You can turn off the Office Assistant by selecting the Options tab in the What Would You Like to Do dialog box and unchecking Use The Office Assistance. Click on OK.

The Open dialog box


The Open dialog box enables you to navigate among your files and Web servers. An optional preview screen shows file content. The bar on the left is called the Places Bar. To get to the particular database that you want to open:

In the Places Bar, click on a shortcut button. The vertical toolbar offers quick access to recently opened files, various special folders, files on the desktop, and remote Web sites. In the Look In drop-down box, select the drive that contains the database. Then in the folder list, double-click on the folders until you open the folder that contains the database.

1-8

Lesson 1: Overview of Access 2000

Figure 1-3: The Open dialog box with the contents of the Student folder displayed.

Task B-2: Starting Access 2000 and opening a database


Before you begin: Your computer is turned on and either Windows 95, Windows 98, or Windows NT 4.0 is running.

What you do
1. Follow your instructors directions to locate and start Access 2000 Observe the on-screen Office Assistant Select Start Using Microsoft
Access

Comments/Prompts
The Office Assistant is displayed on the opening screen. The Office Assistant is an animated online help system that provides help topics and tips while you work.

2.

3.

Point to the Office Assistant and right-click Choose _Hide_

To display the shortcut menu. To hide the Office Assistant without turning it off. The Office Assistant can be used whenever you have a question and need help. To show the Office Assistant, choose the Help menu and select Show The Office Assistant.

1-9

Access 2000: Level 1 (First Edition)

4.

Observe the screen

You have the choice of creating a new database by using either a Blank Database or the Database Wizard, or opening an existing database. The last option is selected by default. 5. 6. Click on OK Observe the Open dialog box The Open dialog box is displayed. (Refer to Figure 1-3.) The bar on the left is called the Places Bar.

If you click on the History shortcut, Access displays a list of shortcuts to databases you have opened previously. The My Documents folder is the default location to store all your original databases and other files, enabling you to back up just one folder. It is the default folder for new Microsoft Access databases. The Desktop shortcut provides you with the option of finding or saving a file on the desktop. The Favorites folder stores shortcuts to databases and other files you use frequently, including those in remote locations, so that you do not have to search for the files each time. The Web Folder stores folders that are shortcuts to Web servers.

7.

Follow your instructors directions to open the Student folder

The Student folder contains a set of data files that will be used throughout the course. (You can use the Current Drive/Folder drop-down list to navigate to the Student folder on the hard drive.)

1 - 10

Lesson 1: Overview of Access 2000

8.

From the Student folder list, select Intro Click on Open When the Intro database is opened, the Database window is displayed behind the Office 2000 Registration Wizard dialog box.

9.

Observe the Office 2000 Registration Wizard

Registering gives you access to update information, product support, and the Office Update web site. You have three options to Click on: Next> (to register via the Internet), More Options (to see other registration options), or Register Later (to register at another time). To register at a later date. The database window is displayed.

Click on No

The Access environment


Concepts > When you start Access, the Startup window is displayed. It contains a title bar, a menu bar, a toolbar, and a status bar.

The title bar and its elements


The title bar is at the top of the window. It contains the following items:

Control-menu icon: A key icon on the far left side of the title bar. It provides a list of commands used to change the size and position of the application window or to close it. Program title: The words Microsoft Access are displayed to the right of the key icon. Minimize button: The dash on the right side of the title bar. It shrinks the application window to a button that reads Microsoft Access on the taskbar. Maximize button: The box to the right of the Minimize button. It enlarges the application window to fill all available screen space. Close button: The x on the far right side of the title bar. It closes both the open database and the Access application.

The menu bar


The menu bar is located immediately below the title bar. Like other Windows-based programs, the menus drop down to display commands. To display a menu, click once on the menu option. The menus display commonly used commands in dark gray. To activate a command, choose one and click on it.

1 - 11

Access 2000: Level 1 (First Edition)

Access 2000 menus and toolbars are adaptive, which means that they change as you use them. For example, when you first open a menu, it is displayed in short form; some choices are not displayed. The menus in Access 2000 extend to display less commonly used commands in light gray. There are two ways to extend displayed menus: click once on the drop-down arrows located at the bottom, or pause the mouse pointer on the menu name on the menu bar, or on the drop-down arrows. You can then choose one of the available commands to activate it. After you choose a menu command from the fully displayed menu that was not available in the short menu, that command will be displayed in the short menu the next time it is used; the new command will displace an unused (or least recently used) command.

The toolbar
The toolbar is located below the menu bar. The toolbar includes buttons with icons (small pictures representing options) that you can use to perform actions quickly. The buttons displayed on the toolbar change, depending on the type of window that is open. To display the name of the button, place the mouse pointer directly over the button and pause. Access displays the name in a ScreenTip under the button. The Access 2000 toolbars are also adaptive. On a toolbar, the More Buttons button provides you with access to the many buttons that are not displayed on either toolbar. Whenever you use the More Buttons list to click on a button that is not currently displayed on a toolbar, that button is then placed on the appropriate toolbar; it displaces an unused (or least recently used) button.

The status bar


The status bar is the area at the bottom of the window. It displays messages that enable you to use the menus more efficiently and that guide you in performing tasks.

Title bar Menu bar Toolbar

Object bar

Status bar

Figure 1-4: The Access screen with the Database window displayed.

1 - 12

Lesson 1: Overview of Access 2000

Task B-3: An orientation to the Access menus and toolbar


What you do
1. 2. Observe the menu bar Place the mouse pointer over the File menu Click the mouse button The File menu drops down, displaying such commands as New, Open, Save, and Save As. Not all menu commands are displayed initially. The keyboard shortcuts (listed next to the corresponding command) perform the same function as selecting a menu command. For example, pressing Ctrl + N is the same as choosing File, New. The icons (next to the command) correspond to the toolbar button that performs the same function. For example, clicking on the Open button is the same as choosing File, Open. The Edit menu drops down, displaying many of the editing commands. At the bottom of the menu, a downward-pointing arrow (chevron) is displayed, indicating that other menu choices are available and can be displayed. (Or place the mouse pointer on the chevrons at the bottom of the menu.) Menus extend by pausing on them or pointing to the chevrons at the bottom of the menu. To close the Edit menu. (You can also choose another menu to display that menu and close the Edit menu, or you can press Escape.) Each of the menus extends to display less common selections in light gray. After a light gray selection is used, it is part of the drop-down menu and is dark gray. To close the Tools menu. The toolbar contains buttons that you can use to perform certain tasks.

Comments/Prompts
File, Edit, View, Insert, Tools, Window, and Help are the menu choices.

3.

Observe the keyboard shortcuts on the right side of the drop-down menu Observe the icons on the left side of the drop-down menu

4.

Move the mouse pointer to


Edit

As you pause over the open Edit menu, observe that the menu extends 5. Choose Edit

6.

Click on Tools and extend the menu by pointing to the chevrons at the bottom of the menu Click on Tools

7. 8.

Observe the toolbar Place the mouse pointer over the leftmost toolbar button Do not click the mouse button

After a few seconds, a ScreenTip is displayed; it gives a short description of the buttons function (New).

1 - 13

Access 2000: Level 1 (First Edition)

Practice Task
1. Display the remainder of the menus to explore the commands that are available. Explore the ScreenTips of the toolbar buttons. Do not click on any of the menu commands.

2.

Do not click on any of the buttons.

The Database window


Concepts > The Database window is the primary workspace of the Access environment. It contains the objects that together make up an Access database.

Task B-4: An orientation to the Database window


What you do
1. 2. Observe the Database window In the Database window, observe the Object bar Observe the object buttons that are in the Object bar Observe the buttons on the Database window toolbar The Database window toolbar contains the Open, Design, and New buttons. These buttons are used to open or modify existing objects and to create new ones. 5. Observe the first three choices in the Database window The Database window contains choices that are the equivalent of using the New toolbar button. The choices are used to create new objects, using one of several methods. 6. Observe the list of table objects

Comments/Prompts
(Or refer to Figure 1-4.) (The vertical bar in the left pane of the Database window.) It enables you to view and switch between the different objects of a database. The Tables button is selected, and a list of table objects is displayed in the Database window.

3. 4.

Tables and other objects in each of the databases in this course have been named according to naming conventions. The tbl tag designates each of these objects as tables.

1 - 14

Lesson 1: Overview of Access 2000

Naming conventions
Concepts > Sound database development requires that you name objects consistently. Naming conventions are not necessary, but they make your work consistent and easy to share. By using naming conventions, you clearly identify each object. This enables you to review and troubleshoot a database design without decoding your work. If more than one person works on an application, it is important to use naming conventions so work can be shared. Naming conventions also make programming easier. The naming convention used in this manual is the Leszynski Naming Convention, also known as the LNC. This convention suggests that you precede object names with three letters, called a tag, that indicate the type of object it is. Tags are always lowercase, and the object name begins with an uppercase letter. To make reading and typing the object names easier, and to be compatible with other programming tools, do not use underscores and spaces.

Important Note: How to get the Leszynski Naming Conventions for Access 2000
Note: You can get copies of the full LNC document from Kwery Corporation, and on

the Access forums on CompuServe and the Microsoft Network. The following additional information is also available: the Leszynski Naming Conventions for Microsoft Solution Developers paper, the Leszynski Naming Conventions for Microsoft Visual Basic paper, Windows Help file versions of each LNC document, and LNC programmers tools such as code wizards. Contact Kwery via the order line at 1-800-ATKWERY, or the product information line at 425-644-7830, by fax at 425-644-8409, or on the Web at http://www.kwery.com. The following table shows the tags for various types of objects in Access:

Object
Table Form Query Report Macro Page

Tag
tbl frm qry rpt mcr pge

Object names must:


be preceded by the designated three-letter tag in lowercase letters. begin with an uppercase letter. contain only letters or numbers. have no spaces or underscores.

1 - 15

Access 2000: Level 1 (First Edition)

Task B-5: An introduction to naming conventions


q Objective: To match the LNC naming convention tag with the proper object.

What you do
1. Match the tags on the left with the objects on the right: A. frm B. tbl C. qry D. rpt

Comments/Prompts

__________ Form __________ Query __________ Table __________ Report

Observing Access objects


Concepts > An Access database is made up of objects with different functions. You can think of a database as being like a librarya collection of information divided into organized, related sections or rooms. A library has tools, such as a librarian, card catalog, or computer that help you find specific information quickly. A database is divided into tables that enable you to collect and organize information on a particular topic. Access has tools, such as queries, forms, and reports that also help you find and use specific data quickly.

Task B-6: Opening, viewing, and closing database objects


q Objective: To observe the functions of sample database objects.

What you do
1. 2. Observe the Database window Select tblPersonalData In the Database window toolbar, click on Open

Comments/Prompts
Table names are listed alphabetically. Each table categorizes and stores related information.

To open the selected table. Tables enable you to collect and organize information on a particular topic. Data in a table is stored in rows and columns. In the Table window, click on the Close button

1 - 16

Lesson 1: Overview of Access 2000

3.

In the Database window Object bar, select Queries

To view a list of the available query objects. The icon next to each name corresponds to the icon on the Queries button. 4. Select qryRSDeptEmployees Click on Open To open the selected query. This query provides results to the question, Which employees work in the RS (Relocation Services) Department? A query is an object that enables you to ask questions of, analyze, and select data that is stored in tables. (You might have to adjust the placement of this window to view the Close button.) To display a list of form objects. To open the selected form. This form is used for entering and viewing information that is stored in a table or query. You can create added features on a form not possible in the table, such as a header, background color, pictures, and different format options. This is another type of form called a tabular form. Tabular forms enable you to see only the fields you want in a spreadsheet format. In this case, only first and last names and phone numbers are included in the form. To display a list of report objects. To preview the selected report. A report enables you to analyze and print data in a specific format. This report lists employees names and the parking lot they are assigned to; employees are grouped by department.

In the Select Query window, click on the Close button 5. 6. In the Database window Object bar, select Forms Double-click on
frmEmployeeInformation

In the Form window, click on the Close button 7. Double-click on


frmPhoneData

In the Form window, click on the Close button 8. 9. In the Database window Object bar, select Reports Right-click on rptParkingLot Choose _Print_Preview_ In the Report window, click on the Close button 10. In the Database window Object bar, select Tables 11. Close the Database window

To display the list of table objects.

1 - 17

Access 2000: Level 1 (First Edition)

c
Concepts >

Database planning and design


Planning a database
Planning is the most important step in creating a database. It is critical that you plan ahead before creating the files in which you will store data. If you thoroughly evaluate your needs, in terms of what information should go into your database and what information you want to get out of it, you are less likely to discover that you are missing vital information or that your data is less than optimally organized. Although you can always make changes to a database later on, doing so can be time consuming. Each database you create should be set up for a specific purpose (for example, recording personnel information). When planning a database, always ask yourself the following question: What kind of information should the database store and what should the database do? Consider the following issues from the standpoint of you (the designer) and others (the users):

What questions will be asked of the data? What reports will need to be produced? What forms will be useful? How will the data be sorted and grouped?

Task C-1: Planning a database


q Objective: To discuss the activities associated with database planning and to apply the ideas to a fictitious work setting.

What you do
1. Suppose you work in the Personnel Department for a small company. You have a database of employee information. What is the purpose of that database? 2. What questions do you think you might ask of that data?

Comments/Prompts

________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________

3.

What reports might you need to produce?

1 - 18

Lesson 1: Overview of Access 2000

4.

What forms will be most useful?

________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________

5.

How might you want to group or sort the data?

Ground rules for database design


Concepts > Each database is set up for a specific purpose. What you include in the database and how you store the data will have an impact on what you can or cannot do with the database later on. If you want to design the database so that you and others can easily accomplish what you have planned for it, you must focus on two main issues: fields and tables.

Designing fields
Each field should contain the smallest meaningful value possible. Fields are usually determined by the data itself. For example, a database of personnel information would include fields for name, address, birth date, phone extension, hire date, pay rate, and so on. Putting the first and last names into a single field makes it difficult to sort the database by last name. If you place the first and last names in different fields, then sorting the database is much easier. You need to consider the types of data that you plan to put in each field. Some of the most common field data types are Text, Integer, Currency, and Date/Time.

Designing tables
Each table should focus on one topic and should store only the data related to that topic. All of the information should be closely related. For example, in a personnel database, you might have one table for employee name and address, another for payroll information, another for parking information, and another for department information. Because Access is a relational database system, you can view the information from all the tables at the same time by joining, or relating, the tables to one another. You should divide fields into multiple tables for the following reasons:

To eliminate redundant information. In a computerized file, you can do away with duplication by storing information in one place. This process reduces both the amount of data entry required and the potential for data-entry errors. It also saves storage space. To make managing data easier. Extremely large tables can be difficult to work with. For instance, it may be cumbersome to find or summarize information. Using multiple tables increases data versatility. To make future changes to the database design easier. Maintaining separate tables makes it easier to accommodate change. You can avoid having to frequently restructure the files to accommodate new data.

1 - 19

Access 2000: Level 1 (First Edition)

Emp Id
EN-10 EN-27 EN-39 EN-41

First Nam e
Bruce Sara Nate Amy

Last Nam e
Smith Fink Cole Guya

Address
100 Park Ave 801 59th St. 19 Jane St. 14 Bleeker St.

City
Clinton Kearny Oradell Parlin

State
NY NY NJ NY

Pay Rate
21.00 17.00 16.00 19.50

Dept Dept Name Mgr


IS TD IS SS Strick Rivet Strick Shipe

Parkin g Lot
MA MA BL WI

Park Fee
13.25 13.25 12.00 10.75

Figure 1-5: A table that contains design flaws.

Task C-2: Examining a table that contains design flaws


q Objective: To examine a table that needs to be divided into multiple tables.

What you do
1. 2. Observe Figure 1-5. Do you see any data that has been entered multiple times?

Comments/Prompts
This table includes comprehensive employee information; however, it is not designed well. ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________

3.

Suppose you had to change the Parking Fee for a specific lot. Would you rather do that in one place or in every record that was affected by the change? The payroll information changes frequently and is highly confidential. Would it be better to place that information in a separate file? Suppose each department was assigned a number code. How would this affect the database? Suppose you also wanted to keep track of other employee information. Would you continue to add new fields?

4.

________________________________________

5.

________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________

6.

7.

Suppose you had 5,000 records in this table. Do you think it would be easy to manipulate?

1 - 20

Lesson 1: Overview of Access 2000

1 - 21

Access 2000: Level 1 (First Edition)

An introduction to relationships
Concepts > Because Access is a relational database-management system, you can view the information from all of the tables at the same time by joining, or relating, the tables to one another. After you define relationships between the tables, you have the flexibility to bring the data from multiple tables together in a query, form, or report.

Personal Data Id First Name Last Name Address City State Zip Phone Hire Date

Human Resources Data Id Hours Pay Rate Parking Lot Code Department Code Health Care Comments

Department Names and Codes Department Code Department Name

Figure 1-6: An example of three tables in a relational database.

Using a common field


When creating relationships between your tables, you always work with two tables at a time. To join two tables, each table must contain a common field. These common fields must contain identical information for each record.

Types of relationships
There are three types of relationships that can exist between two tables: one-to-one, one-to-many, and many-to-many. Only those tables with a one-to-one or a one-tomany relationship should be joined. To determine the type of relationship between two tables, examine the data in the common field.

Personal Data Id First Name Last Name Address City State Zip Phone Hire Date

Human Resources Data Id Hours Pay Rate Parking Lot Code Department Code Health Care Comments

Figure 1-7: An example of a one-to-one relationship. A one-to-one relationship exists when one of each data value in the common field of the first table matches one of these values in the second table. For example, Personal Data and Human Resources Data have a one-to-one relationship; each record in the first table has a corresponding record in the related table.

1 - 22

Lesson 1: Overview of Access 2000

In many cases, the data contained in two tables with a one-to-one relationship can be combined into one table. However, there may be reasons why you would want to keep them separate. For example, if the content of one table is confidential or changes more often than the data contained in the second table, keeping the tables separate might be warranted.

Department Names and Codes Department Code Department Name

Human Resources Data Id Hours Pay Rate Parking Lot Code Department Code Health Care Comments

Figure 1-8: An example of a one-to-many relationship. A one-to-many relationship exists when one of each data value in the common field of the first table matches more than one of the values in the second table. For example, Department Data and Human Resources Data are in a one-to-many relationship because the Department Data table lists each department only once, but there are multiple corresponding records in the Human Resources Data table.

Task C-3: Examining relational tables


What you do
1. 2. Observe Figure 1-6. What is the common field in the Personal Data and Human Resources Data tables? What is the relationship between the Personal Data and Human Resources Data tables? What is the common field in the Human Resources Data and the Department Data tables? What is the relationship between the Department Data and the Human Resources Data tables? Consider how information from various tables can be combined in a form, query, and report.

Comments/Prompts
These tables keep track of Personnel Information. ________________________________________

3.

________________________________________ ________________________________________

4.

________________________________________

5.

________________________________________ ________________________________________

6.

For example, you could combine the First Name and Last Name fields, the Hours field, and the Dept Name field from different tables to create a single report.

1 - 23

Access 2000: Level 1 (First Edition)

Wrap-up for Lesson 1


List some examples of how you might use Access 2000.

Identify the Access 2000 term that goes with each of the following definitions: A single set of related data values:

A category of information within a table:

A collection of data related to a particular topic or purpose:

Suppose you have a table that is a club roster; it contains information about each club member. Identify the object you would use in each of the following situations: a form, query, or report. You want to know how many people have not paid club dues.

You want to enter information for a new club member in an arrangement that resembles the paper membership application.

You want to print out the names and phone numbers for members grouped according to their interests.

Why might you use a naming convention to name Access objects?

What is the purpose of using multiple tables?

Why might you create a relationship between two tables in Access?

1 - 24

Creating tables

Lesson objectives
To be able to design and create tables, you will: a Examine a table in both Datasheet View and Design View to compare the table structure to its underlying design. b Create a table by using the Table Wizard.

c Create a table by using Design View. d Examine how primary keys affect the data in a table.

2-1

Access 2000: Level 1 (First Edition)

a
Concepts >

Examining a table
Viewing a table in Datasheet View
By opening a table, you bring a copy of its data into computer memory and display the information in Datasheet View. Datasheet View provides a tabular view of your dataeach column is a field and each row is a record. In Datasheet View, you can add, edit, or view the data in a table. You can also check spelling, print the table data, filter or sort records, change how the datasheet is displayed, and change the table structure by adding or deleting columns.

Figure 2-1: The tblHumanResourcesData table in Datasheet View.

Task A-1: An orientation to Datasheet View


What you do
1. Click on the Open button Select Examine Click on Open Maximize the Database window 2. Right-click on
tblHumanResourcesData

Comments/Prompts

The contents of the Student folder are listed. Table names are listed alphabetically.

Choose _Open_
2-2

To open the selected table by using the shortcut menu.

Lesson 2: Creating tables

3.

Observe the table Datasheet View window

The toolbar buttons displayed in Datasheet View are different from those displayed in other windows and views. The status bar verifies that you are working in Datasheet View.

4.

Observe the fields

Each column is a field; the field names are listed across the top. The fields are ID, Hours, Pay Rate, Parking Lot Code, Health, Dept Code, and Comments. Each row is a record.

5.

Observe the records

Records are in order by the ID field. Values in the Hours field display decimals only if needed. Values in the Pay Rate field have dollar signs and two decimal places. The Health field displays a checkmark if the employee has health care. The Comments field displays descriptive text.

6. 7.

Observe the record indicator Observe the status area

The dark triangle in the far left column; it points to the active record.

The status area indicates the number of records. How many records are there? 8. Which record is active? How do you know? ________________________________________ ________________________________________ ________________________________________ ________________________________________

Table navigation
Concepts > You can use your mouse to navigate within the table. Scroll bars frame the right and lower borders of the window. You can use the scroll bars to change the portion of the table displayed in the window. Navigation buttons are located in the lower left portion of the window. You can use them to make a record current.

2-3

Access 2000: Level 1 (First Edition)

Task A-2: Navigating in a table


q Objective: To compare the scroll bars to navigation buttons as means of moving through records in a table.

What you do
1. Experiment with using the scroll bar to move within the table

Comments/Prompts
Notice that if you use the scroll bar, you do not change the active record.

Using the scroll bar


Click on the down scroll arrow several times Drag the vertical scroll box to the bottom of the scroll bar Click on the up scroll arrow several times Drag the vertical scroll box to the top of the scroll bar Click on the right scroll arrow several times Drag the horizontal scroll box to the left 2. Experiment with the navigation buttons

To move
Down one record per click. To the end of the table rapidly. Up one record per click. To the top of the table quickly. To view the last field in the table. To the first field in the table quickly. (Located in the lower left corner of the datasheet window.) Notice that the record indicator moves when you use the navigation buttons.

Navigation button
Next Record Previous Record Last Record First Record 3. Double-click in the Specific Record Number box

To move to
The next record. The previous record. The last record in the table (record 25). The first record in the table (the record for EN1-10).

The navigation buttons frame the Specific Record Number box, which you can use to move to a specific record.

Type 9 Press R 4. Click on the New Record navigation button Click on the First Record button To move to record 9.

An empty record 26 is added below record 25.

To move to the top of the table.

2-4

Lesson 2: Creating tables

Viewing a table design in Design View


Concepts > You can view and modify the design of a table in Design View. A tables design includes the definition of field names, the order in which fields are displayed in the table, the type of data that each field contains, and the size and format of the fields. A table can contain up to 255 fields for each record. A tables design can also include field descriptions and a primary key. If a primary key is defined, then the records in the table will be sorted by the field(s) in the key; moreover, no duplicate information will be allowed in the key field(s).

Figure 2-2: The tblHumanResourcesData table in Design View.

Task A-3: An orientation to Design View


What you do
1. Observe the View button The View button contains an icon of design tools. When you click once on the View button, the view changes to Design View. This is a convenient way to change between views. Click on the View button Observe the View icon To view the design of the table. It changes to reflect the default view you can change or toggle to (in this case, Datasheet View).

Comments/Prompts

2-5

Access 2000: Level 1 (First Edition)

2.

In Design View, in the Field List pane, observe the rows and columns Observe the Field Properties pane

Each row is a field in the table. The columns are Field Name, Data Type, and Description. Field properties control aspects of the field, such as size, format, and caption.

3.

Field definitions
Concepts > To define a field:

Choose a field name. Choose what type of data the field will contain. Determine if that field is a primary key field. Decide on its field properties.

Field names
In this course, the Leszynski Naming Conventions (LNC) are used to define field types in field names. A tag is added to the beginning of the name; it appears before the field name in lowercase characters. Each word in the field name itself begins with an uppercase character. The field name does not contain spaces. For example, you want to keep track of employees first names. The field name would be strFirstName, with the str tag defining the data type as text. The LNC suggests the following tags for defining data types in field names:

Data type
Binary Byte AutoNumber Currency Date/Time Double Integer

Tag
bin byt lng cur dtm dbl int

Data type
Long Memo Ole Single Text Yes/No

Tag
lng mem ole sng str ysn

Data types
The characteristics of the data you plan to store in a table help you to determine the data type you need. Data type determines the kind of data that can be entered in a field and what kinds of operations Access can perform on it. The following table describes the different data types and their uses:

2-6

Lesson 2: Creating tables

Select this
Text Number Currency Date/Time Yes/No Memo AutoNumber OLE object

If the data consists of


Text and numbers that are not involved in calculations or that contain leading zeros (for example, phone numbers and zip codes). Numeric data for calculations (except calculations involving money). Values representing money. Dates and times; a variety of display formats are available. Fields that contain only one of two values (for example, Yes/No, True/False, or On/Off.) Lengthy text and numbers, such as comments or explanations. Sequential numbers assigned by Access. An Object Linking And Embedding object created in another application.

Primary key
A primary key is a field (or combination of fields) that uniquely identifies each record in a table. Fields that can serve as primary keys include employee IDs, customer account numbers, purchase order numbers, and part numbers. Every table includes a primary key so that many operations can be performed faster. Access automatically sorts the records in the table by the values in the primary-key field. Access will not permit you to enter records that contain duplicate values in the primary-key field, nor will Access permit you to leave these fields blank.

Field properties
Each field has a set of properties that you can use to customize how a fields data is stored, handled, or displayed. The properties that are available for each field are determined by the data type you select for the field. When you select a data type or set a field as a primary-key field, certain properties are automatically set for it. For example, number and currency fields have a default value of 0; a text field allows 50 characters; a primary-key field is set to be indexed. By using the Field Properties pane, you can control the attributes of the field by changing the assigned properties or by affecting other properties.

2-7

Access 2000: Level 1 (First Edition)

Task A-4: Examining the table design


q Objective: To view the design of the fields for the tblHumanResourcesData table.

What you do
1. Observe the field names

Comments/Prompts
The field names follow the Leszynski Naming Convention. Field names can be as many as 64 characters in length, including spaces.

2.

Click on the selector button to the left of strEmpId

To select the strEmpId field. The data type is text, which allows a maximum of 255 characters to be stored. The Key icon indicates that strEmpId is the primary key for the table; it uses a unique value to identify every record in the table. The field size is six, allowing a maximum of six characters to be stored. The caption is Id. This property enables you to specify a label to display in reports and forms instead of using the field name. Because strEmpId is the primary key, the Indexed property is Yes (No Duplicates). This property causes the records to be sorted by ID; no duplicate ID value can be entered. The Data Type is Number, the Field Size is Double, the Decimal Places is Auto, and the Caption is Hours. Number fields can be used in calculations. The Data Type is Currency, the Format is Currency, Decimal Places is set to Auto, and the Caption is Pay Rate. Currency fields can be used in calculations. The Data Type is Yes/No and the Caption is Health. The Data Type is Memo and the Caption is Comments. Memo fields can contain up to 64,000 bytes of text per record. (Click on the Close button.) The Database window is displayed.

Observe the icon on the selector button 3. 4. Observe the Field Size field property Observe the Caption field property Observe the Indexed field property

5.

6.

In the Field Name pane, select dblHours Select curPayRate

7.

8. 9.

Select ysnHealth Select memComments

10. Close the Design View window

2-8

Lesson 2: Creating tables

b
Concepts >

Creating a table with the Table Wizard


The Table Wizard assists you in creating a table by offering sample tables for different applications. Each sample table contains a set of sample fields specific to the application. You select the sample table and fields that you want; Access builds the table.

Task B-1: Selecting sample tables and fields


q Objective: To create a table by using the Table Wizard.

What you do
1. 2. Verify that the list of table objects is displayed Click on the New button

Comments/Prompts
(In the Object bar, select Tables.)

To display the New Table dialog box. 3. Select Table Wizard Click on OK

To use the Wizard to create a new table to store data. 4. Observe the Table Wizard dialog box

A list of sample tables is provided. Field names for the selected sample table are displayed in the Sample Fields box. 5. From the Sample Tables list, select Employees The sample fields displayed are for the selected table.

2-9

Access 2000: Level 1 (First Edition)

6.

From the Sample Fields list, select EmployeeID Click on > To add EmployeeID to the Fields In My New Table list.

7.

Add the following fields to the Fields In My New Table list:


FirstName StateOrProvince LastName PostalCode Address HomePhone City DateHired

Deciding the field to use for a primary key


Concepts > When you create a table, you need to decide the field to use as a primary key. When you use the Table Wizard, you can choose the primary key after you finish designing the table, or you can let Access choose the primary key for you. If you let Access choose it, the primary key field will be an AutoNumber field. An AutoNumber field is a field that automatically increments and enters a unique integer for each new record.

Task B-2: Naming the table and setting the primary key
What you do
1. Click on Next> In the What Do You Want To Name Your Table textbox, type tblEmployees 2. On the Table Wizard dialog box, read the description of the primary key Verify that Yes, Set A Primary Key For Me is selected

Comments/Prompts
To advance to the next Table Wizard dialog box.

3.

To have Access set the primary-key field.


2 - 10

Lesson 2: Creating tables

4. 5.

Click on Next> Click on Next>

To move to the next dialog box. No tables are related to the table you are creating. This dialog box is displayed because there are other tables in the database.

Table modifications
Concepts > Although the Table Wizard creates a table that is close to what you want, you will probably need to modify it. You can revise the table in Design View. You can change field names, data types, and any of the field properties.

Task B-3: Viewing the table design


What you do
1. 2. Observe the Table Wizard dialog box Verify that Enter Data selected
Directly Into The Table is

Comments/Prompts
You have entered all the information necessary to create a table.

3. 4.

Click on Finish Observe the field names

To display the table in Datasheet View. Captions, not field names, are displayed; spaces and slashes have been added. The Employee ID field is an AutoNumber field. To switch to Design View. An object naming convention was not used. It is an AutoNumber field because Access designated it as the primary-key field. Employee IDs will be automatically entered, beginning with 1, in sequential order. ______________________________________________

5. 6. 7.

Click on the View button Observe the Field Name column Observe the data type for the EmployeeID field

What data type would be appropriate for Employee IDs such as EN1-99?

2 - 11

Access 2000: Level 1 (First Edition)

8.

Select the FirstName field Observe the Field Properties What field size would be appropriate for this data? The Field Size is 50. The Caption is First Name (a space is between the words). Fifteen, because most first names are no longer than fifteen characters. The new table object, tblEmployees, is listed.

9.

Close the Design View window and observe the Database window

2 - 12

Lesson 2: Creating tables

c
whats new

Creating a table in Design View


The following new software features are discussed in this topic:

Redesigned File Management dialog box (File, Save)

Concepts >

You can create a table in Design View. Using Design View gives you greater control over field names and field sizes than by using the Table Wizard. If you use a naming convention, you can name the fields according to the convention rules and use the Caption property to display an easy-to-read field heading. The following form contains Human Resource information; it could be the basis for a table. Creating the table from scratch requires you to make several decisions:

What will you name your fields? In what order will they be displayed in the table? What type of data will each field contain? Will you adjust the size and format of the fields?

EMPLOYEE HUMAN RESOURCES DATA Emp #: EN1-19 Hours/Week: 40 Dept Code: Rate/Hour: IS $22.75 Hire Date: _______ Health: Yes

Comments: Barbara was promoted to Senior Technical Specialist last May.

Figure 2-3: The paper data form that contains Human Resources data.

Figure 2-4: The completed tblMyRatesAndHours table design.

2 - 13

Access 2000: Level 1 (First Edition)

Task C-1: Creating a new table object


What you do
1. In the Database window, double-click on Create Table
In Design View

Comments/Prompts

2.

Examine the tables Design View window

The table is titled Table1. No fields have been created; therefore, the Field List and Field Properties panes are empty.

Field names
Concepts > In Access, field names can be up to 64 characters long. They can include any combination of letters, numbers, spaces, and special characters except leading spaces, periods (.), exclamation points (!), square brackets ([ ]), and control characters (ASCII values 0 - 32).

Changing the field size


Access can process smaller field sizes quickerchanging the maximum number of characters you can enter in a field also helps to reduce errors.

Adding a caption
If you do not add a caption, the field name will be displayed as a heading for the field. In this course, because the LNC tags are used for field names, captions will be used so that the headings are more descriptive.

Task C-2: Creating text fields


q Objective: To create several text fields, and in each case, to change the field size and add a caption.

What you do
1. Type strEmpId Press T 2. 3. Observe the Data Type Press 6

Comments/Prompts
To name the field strEmpId. Type field names exactly as you want them displayed in the table. The LNC tag str is used because the field will store a text string. The default Data Type (Text) is entered. To move to the Field Properties pane. Text is accepted as the data type, and the Field Size property value is selected. The default size of a Text field is 50. To define the field size of the strEmpId field as 6.

4. 5.

Observe the field size Change 50 to 6

2 - 14

Lesson 2: Creating tables

6.

Click in the Caption property box Type ID

To place the insertion point and define a label to use for the table headings, form labels, and report labels. Otherwise, strEmpId would be used. To return to the top pane.

7. 8.

Press 6 In the Field Name column, place the insertion point in the next blank row

Practice Task
Add the following field to store the Department Code for each employee: Field name: strDept Field size: 2 Data type: Text Caption: Dept Code

Task C-3: Creating a Yes/No field


Before you begin: Complete the Practice Task at the end of Task C-2.

What you do
1. In the Field Name column, place the insertion point in the next blank row Type ysnHealth Press T 3. 4. 5. In the Data Type column, display the drop-down list Select Yes/No Observe the Field Properties pane

Comments/Prompts

2.

To name the next field ysnHealth. The LNC tag ysn is used because the health field will store Yes or No values. (Click on the down arrow.) To define the data type for the ysnHealth field as Yes/No. There is no Field Size property for a Yes/No field. This property does not apply because Yes/No fields display a checkbox.

Practice Task
Add the caption Health.

2 - 15

Access 2000: Level 1 (First Edition)

Selecting a format
Concepts > You can customize the way information is displayed in your database. For example, in a Date/Time field, you can choose a date or time format that suits your own personal preference.

Task C-4: Creating a Date/Time field and selecting a format


What you do
1. In the Field Name column, place the insertion point in the next blank row Type dtmHired Press T 3. In the Data Type column, type d Press R 4. Observe the Field Properties pane In the Field Properties pane, place the insertion point in the Format property box Display the Format dropdown list There is no Field Size property for a Date/Time field. The field size is set according to the Format property for the field. To name the field dtmHired. The LNC tag dtm is used because the field will store hire date information. To select the Date/Time option.

Comments/Prompts

2.

5.

6.

The Format drop-down list contains examples of the date and time formats. 7. Select Short Date To select a date format of mm/dd/yy.

Practice Task
Add the caption Hire Date.

2 - 16

Lesson 2: Creating tables

Adding a field description


Concepts > You can use the Description column of the Field List pane to enter a description for a field. The Description field text is displayed in the status bar when you are entering data for the field and can help you remember what information to enter in a field.

Task C-5: Creating a Number field and adding a field description


What you do
1. In the Field Name column, place the insertion point to enter the fifth field name Type intHours Press T 3. 4. 5. In the Data Type column, type n Press T Type Normal weekly hours To name the field intHours. The LNC tag int is used because the field will store integer values. To define the intHours field as a Number field. To move to the Description column. To enter a field description. This description is displayed in the status bar in Datasheet View when the insertion point is in the Hours field. To set the field size. The default Field Size property for a Number field is Long Integer. (Or type i.) Using the Integer field size is advisable in this case; smaller data sizes can be processed faster and require less memory.

Comments/Prompts

2.

6.

In the Field Properties pane, select the Field Size property, if necessary From the drop-down list, select Integer

Practice Task
Add the caption Hours.

2 - 17

Access 2000: Level 1 (First Edition)

Task C-6: Creating a Currency field


What you do
1. 2. 3. Add a field named
curPayRate

Comments/Prompts
To name the field curPayRate. The LNC tag cur is used because the field will store currency values. To define the curPayRate field as a Currency field. The format of a Currency field is set to Currency. The format for Decimal Places is set to Auto by default.

In the Data Type column, select Currency Observe the Field Properties pane

Practice Task
Add the caption Pay Rate.

Task C-7: Creating a Memo field


What you do
1. Add a field named
memComments

Comments/Prompts
To name the field memComments. The LNC tag mem is used because the field will be a Memo field and will store up to 64,000 characters. To define the memComments field as a Memo field. The Required and Allow Zero Length properties are set to No. Data entry is optional for this field.

2. 3.

In the Data Type column, select Memo Observe the Field Properties pane

Practice Task
Add the caption Comments.

Setting the primary key


Concepts > Once your table is set up the way you want, you need to save it. When you save the design of a table without defining a primary key, Access displays a dialog box that asks if you want it to create a primary key. The dialog box contains three option buttons.

2 - 18

Lesson 2: Creating tables

Option
Yes

Action taken by Access


Creates a field named ID (or ID1 if you already have a field with ID in the field name) with the AutoNumber data type. (If your table already has a field with the AutoNumber data type, Access uses that field as the primary key when you choose Yes.) When you add the first record to the table, Access enters a value of 1 in this ID field, and numbers each new record sequentially. Saves the table without a primary key. Returns to Table Design View, where you can set a primary key.

No Cancel

Task C-8: Setting the primary key and saving the table design
What you do
1. Click on the Save button (To save the table design.) The Save As dialog box is displayed.

Comments/Prompts

2.

Type tblMyRatesAndHours Click on OK

To name and save the table design.

3.

Observe the alert box

The alert box indicates that no primary key is defined and asks if you want to create one. 4. 5. 6. Click on No Click on the row selector for strEmpId Click on the Primary Key button To define a primary key on the strEmpId field. 7. Click on the Save button To save the table design. To save the table without adding a primary key. To select strEmpId as the field on which to define a primary key.

2 - 19

Access 2000: Level 1 (First Edition)

8.

Click on the View button To view the table you created.

9.

Observe the table

The field headings correspond to the captions you created in Design View. The Hours and Pay Rate fields display zeros.

10. Close the table

2 - 20

Lesson 2: Creating tables

d
Concepts >

Types of primary keys


Primary keys affect the data in your table. A primary key speeds retrieval of data from large tables, enables you to define default relationships between tables, and enables you to define links between tables in queries. When choosing a primary key, keep in mind that you should use as few fields as possible and that each field you choose should be a short data type (such as integer, number, or short text). This makes it more efficient to maintain the primary key and to use it in joins, which connect two or more tables with a common field. There are three types of primary keys: auto-number, single-field, and multiple-field.

Type of primary key


Auto-number Single-field Multiple-field

Description
Used to automatically enter a sequential number when a new record is added to the table. Set for fields that contain unique values, such as social security numbers, employee identification numbers, or part numbers. Used in situations when one field is not unique, but two fields in combination contain unique values.

Multiple-field primary keys


A primary key may consist of two fieldsfor example, when a table keeps track of employee projects. The Employee ID field would not be a good choice for the primary key because an employee might be working on more than one project, and would have more than one entry in the table. However, the combination of Employee ID and Project Number would produce a unique value.

Viewing or editing indexes


An index helps Access find and sort records faster. You can create indexes based on a single field or on multiple fields. The primary key of a table is automatically indexed. Therefore, a multiple-field primary key creates a multiple-field index. You can view or edit indexes by using the Indexes button on the toolbar.

Task D-1: Setting a multiple-field primary key


What you do
1. Open the tblProjectEffort table Observe the table Change to Design View 2. Is there a primary key for the tblProjectEffort table? This table keeps track of employees and the time they spend on specific projects; each project has a part number. Neither the Employee ID field nor the Part Number field contain unique values. ________________________________________

Comments/Prompts

2 - 21

Access 2000: Level 1 (First Edition)

3. 4. 5. 6. 7.

Click on the row selector for the strEmpId field Click on the Primary Key button Click on the Save button Observe the alert box Click on OK Click on OK

To select the strEmpId field. To define the strEmpID field as the primary key.

The strEmpID field contains duplicate values. This field, by itself, is not a good choice for the primary key. To close the alert box. To close the information box and return to the table Design View window. To designate a multiple-field primary key.

8.

Press and hold S Click on the row selector for the strProjectCode field Release S

9.

Click on the Primary Key button Click on the Indexes button Observe the Indexes window

Close the Indexes window 10. Click on the Save button 11. Change to Datasheet View Observe the sort order 12. Close the table 13. Close the database window

One primary key composed of two fields is defined.

Records are sorted primarily by Employee ID and secondarily by Project Code numbers.

2 - 22

Lesson 2: Creating tables

Practice Unit for Lesson 2


In this activity, you will create a table in Design View and set a primary key. 1. 2. Open the database Newprac. Use Design View to create a table with the following fields, data types, and field sizes:

Field Name
strEmpId strEquipment strSerial# dtmPurchaseDate curPurchasePrice 3. 4. 5. 6. 7.

Data Type
Text Text Text Date/Time Currency

Field size
6 25 15

Caption
ID Equipment Serial Number Purchase Date Price

Change the format for the dtmPurchaseDate field to a format of your choice. Set a primary key on the strEmpId field. Save the table design as tblMyInventory Display the table in Datasheet View. Close the table. Close the Database window.

Figure 2-5: The completed tblMyInventory table design.

2 - 23

Access 2000: Level 1 (First Edition)

Wrap-up for Lesson 2


Identify information from your workplace, and describe some of the fields you would use to make it into an Access table.

Match each view (Datasheet View, Design View) with its description. To add, edit, or view the data in a table, use To view and modify the design of a table, use Which key enables you to toggle between panes in Design View?

What are some advantages of using the Table Wizard?

Given the following set of data categories, fill in the appropriate data type for each: Text, Numeric, Currency, Date/Time, Yes/No, Memo.

Data
Social security numbers Customer names Purchase order dates Product price Inventory levels Phone number A field tracking if an employee has attended Orientation training

Data type
__________ __________ __________ __________ __________ __________ __________

2 - 24

Lesson 2: Creating tables

Label the following statements as true or false. 1. A primary key is a unique identifier for the record. 2. A primary key can be made up of one or more fields. 3. A primary key field cannot be left null. 4. When choosing a primary key field, it is best to use a field that has short values, rather than one with long data.

2 - 25

Working with tables

Lesson objectives
To test the design of a table, you will: a Enter data in a table, and examine how and when Access saves data. b Identify improvements to the design of a table and modify the design in Design View.

c Find specific records and edit their contents. d Work with records and fields by adding, deleting, and copying values. e Sort all the records in a table and filter records that meet a specific criterion.

3-1

Access 2000: Level 1 (First Edition)

a
Concepts >

Adding records
You can use Datasheet View to enter data. When you begin entering data, Access makes a few changes to the datasheet. Most significant is the addition of the record selector, a small gray box located to the left of the record. The record selector can display the following symbols:

Symbol

What it means
The triangle indicates the current record. The record has been saved as it is displayed. The pencil indicates that you have added or edited data that has not yet been saved. The asterisk indicates a new record that you can enter information into. Each table contains a blank record at the end of the table; you must add new records at this location.

Saving data
When you move the focus off a record by using the mouse or an arrow key, or by pressing Tab or Enter in the last field in Datasheet View, the data is saved automatically. If you want to save data in a record without moving the focus, choose Records, Save Record.

Task A-1: Adding and saving a record


What you do
1. Open the Work database Maximize the Database window 2. Open the tblInputRatesAndHours table and observe the fields Observe the table The triangle symbol indicates the current record. The insertion point is in the ID field. The check box for the Health field is empty, indicating a default value of No.

Comments/Prompts

3.

3-2

Lesson 3: Working with tables

4.

Type 0020 Press R Observe the datasheet To enter the value in the ID field and advance to the LN field. As you add data, the triangle is replaced by a pencil. This means that you are editing the record, but you have not saved the data. The asterisk indicates that a new, empty record has been added to the end of the table.

3-3

Access 2000: Level 1 (First Edition)

5.

Type Carney Press R To enter the value in the LN field and to move to the Dept field.

6.

Type TD Press R To enter the value in the Dept field and move to the Health field. A checkmark indicates that the employee is covered by health insurance.

7.

Press s Press R

8.

Type 8/21/94 Press R To enter a hire date.

9.

Observe the datasheet Scroll to view the Hours and Pay fields A zero has been entered in the Hours field. A dollar sign and 0.00 have been entered in the Pay field. The status bar contains the description Normal weekly hours.

10. Type 32.5 Press R Observe the Hours field To enter the normal weekly hours. Decimal places are not allowed in the Hours field because of the way the field has been defined. The value is rounded to the nearest integer. To enter the value for Pay. The Currency field displays a dollar sign and two decimal places. A new blank record has been added to the end of the database. The insertion point is in the ID field on the second row. The pencil icon is no longer displayed next to the first record. When you move the focus off a record, the data is automatically saved.

11. Type 25 Press R 12. Observe the table

3-4

Lesson 3: Working with tables

Practice Task
1. Verify that the insertion point is in the ID field of the second (blank) row. Enter the following records beginning with 0021:

2.

Id
0021 0022 0023 3. 4.

LN
Jacobs Coleman Carney

Dept
MK RS MK

Health

Hd
2/25/93 11/15/92 10/4/95

Hours
40 25 40

Pay
$15.75 $20.25 $21.25

Move the focus off the last record entered. Close the table.

3-5

Access 2000: Level 1 (First Edition)

b
Concepts >

Modifying the table design


After you have created the table and entered some information, you might decide to make some changes to the underlying design of the table. For instance, you might want to change a field name, add a new field, remove a field, or set field properties. You can modify the table design in either Datasheet or Design View. Design View gives you greater control over field names and field properties, such as field size and caption. In Design View, you can also redefine a fields data type.

Cautions when modifying a tables design


Although you can and should modify the design of a table to increase its usefulness, the following issues will help you to minimize any loss of data due to error:

Make a backup copy of the table before you modify the table design. (Copy and paste the table.) Remember that deleting a field also deletes any data the field contains. Delete a field from other objects after you delete it in the table design. If you do not, queries that use the field will not work; forms and reports that contain the field will display an error message. Rename a field in other objects after you rename it in the table design. Remember that resizing a field to a smaller size or type might truncate data that does not fit into the smaller field. Use the Access Help system to get information on data conversion before you change a fields data type.

Task B-1: Identifying improvements to the tables design


What you do
1. Open the tblEmployeeInformation table Observe the LN field You could change the caption LN to Last Name to be more descriptive. You could insert a field for first names to distinguish employees with the same last name, such as Carney. 3. 4. Observe the Hd field Observe the Health field You could change the caption Hd to Hired to be more descriptive. You could remove the Health field (it is no longer needed because health insurance is now provided for all employees). You could change the field to accept and display decimal places.

Comments/Prompts

2.

5.

Observe the Hours field

3-6

Lesson 3: Working with tables

Task B-2: Renaming a field


Before you begin: You are in the Datasheet View of tblEmployeeInformation.

What you do
1. Switch to Design View

Comments/Prompts

To view the design of the tblEmployeeInformation table. 2. 3. In the Field Name column, double-click on strLN Type strLastName Change the caption to Last
Name

To select this field. To change the field name to strLastName.

Practice Task
1. 2. Change the field name dtmHd to dtmHired . Change the caption to Hired .

Task B-3: Inserting and deleting fields


q Objective: To add a First Name field to the table and to delete the Health field from the table.

What you do
1. Click on the row selector for strDept Click on the Insert Rows button In the new row, click in the Field Name column Type strFirstName Press R 4. Press R

Comments/Prompts
To select the location for the new field, which will include an additional category of information in the table.

2. 3.

(Or press Tab.) To name the field strFirstName and move to the Data Type column. To accept Text as the data type.

3-7

Access 2000: Level 1 (First Edition)

5.

Change the field size from 50 to 15 Add the caption First Name

6. 7.

Click on the row selector for ysnHealth Click on the Delete Rows button

To select the ysnHealth field. This information can be removed from the table.

To delete the ysnHealth field and the data contained in it. An alert box asks you to confirm the deletion. Click on Yes

Task B-4: Rearranging fields


q Objective: To move the strFirstName field so it immediately follows the strLastName field.

What you do
1. Observe the table design

Comments/Prompts
The strFirstName field is displayed after the strLastName field. The fields should be rearranged to better organize information in the table. To select the strFirstName field.

2. 3.

Click on the row selector for the strFirstName field Press and hold the mouse button on the row selector Drag the mouse pointer up until a dark line appears between strEmpId and strLastName Release the mouse button

To move the strFirstName field.

3-8

Lesson 3: Working with tables

Changing a fields properties


Concepts > Field properties are a set of characteristics that define a given field. You can change a fields properties to provide additional control over the kind of information you can enter in a field. You can customize how a fields data is stored, handled, or displayed. For example, you can control the maximum number of characters that can be entered into a Number field by setting its Field Size property. (Common settings are Double and Long Integer.) The Integer and Long Integer settings do not include decimals; the Single setting can display up to seven decimal places and the Double setting can display up to fifteen decimal places.

Task B-5: Changing a fields properties


q Objective: To change the Field Size property for a Number field to accept decimal places in the data.

What you do
1. 2. 3. 4. Select the field intHours Press 6 In the Field Size column, display the drop-down list Select Single

Comments/Prompts

To move to the Field Properties pane. Click on the down arrow.

To define the field size.

Practice Task
1. 2. 3. Rename the intHours field to sngHours. Save the modified table design. Switch to Datasheet View and change the Hours field for Jacobs to 35.5. Move off the record to save it. Close the table. (Click on the Save button.)

4. 5.

3-9

Access 2000: Level 1 (First Edition)

c
Concepts >

Finding and editing records


A common database operation is finding and updating specific records. For example, if you manage a database of customers, you must update your table with the new address if one of them moves. Access offers several ways to locate specific records and update their values.

Finding a record by navigating in the datasheet


If you need to find a record in a table that has only a small number of records, it is usually easiest to scroll through the table by using your mouse or keyboard. Using the keyboard to navigate always changes the focus (that is, the current record changes, depending on the location of the insertion point).

Task C-1: Navigating in a table


Before you begin: Complete the Practice Task at the end of Task B-5, or have the Database window active.

What you do
1. Open the tblPersonalData table Use the following table to experiment with navigating in a table

Comments/Prompts
To view the datasheet.

Key T S+T e h b t C+e C+h

Selects the
Next field to the right. Next field to the left. Last (rightmost) field of the record. First field of the record. Same field in the next record. Same field in the previous record. Last field of the last record in the table. First field of the first record in the table.

3 - 10

Lesson 3: Working with tables

Using the Find feature to locate a record


Concepts > When you deal with many records, you can use the Find feature to search for a key word or phrase in any field. You can locate a record by searching for a specific value, such as last name or part number. You can also find the first or next occurrence of a value.

Task C-2: Finding and editing a record


q Objective: To change Lauren Gardners last name to Zee.

What you do
1. If necessary, press C +

Comments/Prompts
To select the first field of the first record in the table. To make it the active field.

h
Select the Last Name field 2. Click on the Find button To find a specific record. The Find And Replace dialog box is displayed. The Look In text box indicates that Last Name is the current field.

3. 4.

In the Find What text box, type Gardner Click on Find Next Observe the datasheet

To find a record where the last name is Gardner. Text is not case-sensitive by default. (Or press Enter.) The last name Gardner is found in record 23. To close the Find And Replace dialog box. The highlight changes to an insertion point. The value is selected again. To enter a new last name.

5. 6. 7. 8.

In the Find And Replace dialog box, click on Cancel Press 2 Press 2 Type Zee Do not move off the record

3 - 11

Access 2000: Level 1 (First Edition)

Undoing changes
Concepts > You can reverse changes to the current field by clicking on the Undo button, by choosing Edit, Undo Typing, or by pressing Escape.

Task C-3: Using the Undo button


q Objective: To return Laurens last name to Gardner.

What you do
1. Click on the Undo button

Comments/Prompts

The last edit (Zee) returns to the original value (Gardner). 2. Press R

Searching all fields


Concepts > From the Find dialog box, you can search all fields for specific data if you do not know which field contains the information you need.

Task C-4: Using Find to search all fields


q Objective: To keep the insertion point in the ID field and find any employee who has the last name Gordon.

What you do
1. 2. 3. 4. Press C + h Click on the Find button Type Gordon Display the Look In dropdown list Select tblPersonalData: Table Click on Find Next 5. 6. 7. Observe the datasheet Click on Find Next Click on Cancel

Comments/Prompts
To move to the first record in the table. To display the Find And Replace dialog box. To find the first occurrence of the value Gordon.

To perform the search in all fields in the table.

There is a triangle icon by the record for Daniel Gordon. The record for Anne Gordon is current.

3 - 12

Lesson 3: Working with tables

Practice Task
1. Move to the first record in the table and find the record for Amy Guya. Close the Find And Replace dialog box. (Search for Amy or search for Guya.)

2.

Undoing changes to a saved record


Concepts > You can reverse all changes to the current record by clicking on the Undo button. Changes to a record are saved when you move the focus off that record, when you choose Records, Save Record, or when you close the datasheet. As long as Datasheet View is active and until you edit another record, you can undo saved changes by clicking on the Undo button. However, as soon as you edit another record, apply or remove a filter, or switch to another window, you cannot use the Undo button to reverse changes.

Task C-5: Undoing a change to a saved record


q Objective: To change the first name of Amy Guya to Amanda Guya and to undo that change after saving the record. Before you begin: Complete the Practice Task at the end of Task C-4.

What you do
1. 2. 3. In the First Name field, change Amy to Amanda Press R Click on the Undo button Observe the datasheet

Comments/Prompts

To move off the record and save the change. You can undo changes to the last-saved record until you begin editing another record. The first name has returned to Amy.

Checking the spelling of data


Concepts > The spelling check feature searches for spelling errors in a table, form, or query. Within a table, you can check the spelling of records, fields, or text within a field. Click on the Spelling button to display the Spelling dialog box. Access checks the data until it finds a word that is not in the dictionary file. The unrecognized word is displayed in the Not In Dictionary text box. You can manually correct the word, replace it from the list of suggested spellings, ignore it, or add the word to the custom dictionary.

3 - 13

Access 2000: Level 1 (First Edition)

Task C-6: Using the spelling check feature


q Objective: To check the spelling of the Comments field.

What you do
1. Place the mouse pointer over the Comments field label and click once Click on the Spelling button Observe the Suggestions box Click on Change

Comments/Prompts
(You might need to use the scroll bars to view the Comments field.) To select the Comments field in preparation of checking the spelling of its contents. When selected, the field is highlighted.

2. 3.

The correct spelling for performance is selected.

4. 5.

Observe the Spelling dialog box Click on Change Click on OK

The word celebrating was misspelled and the correct spelling is selected.

To close the message box.

3 - 14

Lesson 3: Working with tables

d
Concepts >

Deleting, adding, and copying records and values


Before you can delete values or records, you must select them. Selecting data means highlighting it so that Access knows which data you are dealing with. The following table describes the methods you can choose from when selecting data:

To select:
A value

Do this:
Click and drag over the value; or Place the insertion point at the start or the end of the value, then press Shift and the appropriate arrow key.

A field A record

Place the insertion point in the field and press F2; or Click on the left edge of the field. Move to the record and

Click on its record selector; Choose Edit, Select Record; or Select a field and press Shift and Spacebar.

Multiple records

Move to and select the first record and press Shift + Up Arrow or Shift + Down Arrow to select contiguous records; or Click on the record selector of the first record and drag to the last record in a contiguous series.

Deleting values and records


Concepts > After you have selected values or records, you can delete them by clicking on the Delete Record button, by pressing Delete, or by choosing Edit, Delete.

Task D-1: Selecting and deleting records


q Objective: To delete the record for Barbara Zumbo.

What you do
1. 2. 3. Display the Find And Replace dialog box Change the Find What value to Zumbo Click on Find Next From the Look In drop-down list, verify that tblPersonalData:Table is selected Close the Find And Replace dialog box 4. Click on the Delete Record button

Comments/Prompts
(Click on the Find button.) To find the record for Barbara Zumbo. To perform the find operation. The value Zumbo is selected.

To delete the record.


3 - 15

Access 2000: Level 1 (First Edition)

5.

Observe the alert box

6. 7.

Click on Yes Choose _Edit_ Close the menu

To delete the record. The total set of records is now 24 (rather than 25). Notice that you cannot undo the deletion of a record.

Adding records
Concepts > In Access, new records are added at the end of the datasheet. A blank record is always available and is indicated by an asterisk (*) in the record selector.

Task D-2: Adding a new record


What you do
1. Click on the New Record button To add a new, blank record at the end of the datasheet. 2. Type EN1-55 Press R 3. Type your first name Press R 4. Type your last name Press R 5. Type your address Press R To enter a value for the Address field and move to the next field. To enter a value for the Last Name field and move to the next field. To enter a value for the First Name field and move to the next field. To move to the next field.

Comments/Prompts

3 - 16

Lesson 3: Working with tables

Moving or copying data


Concepts > You can place data from one location in a table to another location by moving or copying it. To do this, use the Cut, Copy, and Paste buttons on the toolbar. For example, select the value you want to copy and click on the Copy button. Move to the field that you want to copy information to and click on the Paste button. This reorganizes the table and saves you from having to retype the information.

Copying values
When the insertion point is in a field, you can copy the value from the previous record by pressing Ctrl + . If there is no information in the previous field, you can use the Copy and Paste buttons on the toolbar. You can insert the system date by pressing Ctrl + ;. The system date is supplied by Windows.

Task D-3: Copying values


What you do
1. Observe the insertion point Observe the value in the City field in the previous record 2. Press C + Press R 3. Press C + Press R 4. Press C + Press R 5. Type 201-555-5739 Press R 6. In the Hire Date column, press C + ; Press R 7. Press R To move the focus off the record. To enter todays date. To copy the value for Zip. To enter a value for strPhone. To copy the value for State. To copy the value for City from the previous field record and move to the next field.

Comments/Prompts
The current field is City. The previous record has the value Hackensack in the City field.

3 - 17

Access 2000: Level 1 (First Edition)

e
Concepts >

Filtering and sorting records


Filtering records
At times, you might want to view only those records that match a specific criterion. A filter is a technique that enables you to view and work with a subset of data. You can specify a filter to view only records where the last name is Smith or the city is Rochester.

Task E-1: Creating and applying a selection filter


q Objective: To view the records for employees who live in New York.

What you do
1. 2. 3. Press C + h In the State field of any record, select the value NY Click on the Filter By Selection button

Comments/Prompts
To move to the first field of the first record. To define the criterion for the filter.

To apply the filter. 4. 5. 6. Observe the State field Observe the toolbar Click on the Remove Filter button To remove the filter and view all the records. Access displays only the records that meet the criterion; all five records meet the criterion of NY. Notice that the Remove Filter button is highlighted.

Sorting records
Concepts > Sometimes information in a table might not be in the order you want. When you view the information in a table, you can sort (rearrange) the data based on any field or combination of fields in the table. You can sort records in alphabetic, numeric, or date order. The data stays sorted until you turn off the filter. You can sort data in a table or a form. To perform a sort on one field, select the field and click on either the Sort Ascending button or the Sort Descending button.

3 - 18

Lesson 3: Working with tables

Task E-2: Sorting records in a table


q Objective: To order records by the Zip field.

What you do
1. 2. 3. 4. 5. Place the insertion point anywhere in the Zip field Observe the Sort buttons Click on the Sort Ascending button Observe the table Click on the Sort Descending button

Comments/Prompts
To make Zip the active field. The buttons are Sort Ascending and Sort Descending.

The records are in numeric order by the Zip field, from the least value to the greatest value.

The records are in descending order by the Zip field. 6. Choose _Records_
_Remove_Filter/Sort_

To return records back to their original order (by the ID field).

Multiple field sorting


Concepts > The Sort Ascending and Sort Descending buttons work on only one field at a time. To perform more complex sorts, such as sorting by two or more fields or in ascending order by one field and descending order by another field, you must use the Advanced Filter/Sort window. This window is split into two sections: a table and field list in the upper pane, and the design grid in the lower pane. Select the fields you want to sort by and drag them to the design grid. In the Sort cell, select either ascending or descending, depending on the type of sort you want to perform. Click on the Apply Filter button to perform the sort.

Table and field list

Filter/sort design grid

Figure 3-1: The Records Filter/Sort design screen.

3 - 19

Access 2000: Level 1 (First Edition)

Task E-3: Sorting by more than one field


q Objective: To order records by last name and then by first name.

What you do
1. 2. Choose _Records_ _Filter_
_Advanced_Filter/Sort..._

Comments/Prompts

Observe the Filter window

The tblPersonalData field list is in the upper pane. The filter/sort design grid is displayed in the lower pane. The strZip field and strState field are included because of recent filters and sorts.

3.

Click on the Clear Grid button To delete the fields from the lower pane.

4.

In the tblPersonalData field list, select strLastName and drag it to the first empty field cell in the design grid Select strFirstName and drag it to the empty field cell next to strLastName In the Sort cell for strLastName, display the drop-down list and select
Ascending

To select the strLastName field and perform a primary sort on it.

5.

To select the strFirstName field and perform a secondary sort on it.

6.

To sort in ascending order by last name as the primary sort. To sort in ascending order by first name as the secondary sort.

7.

In the Sort cell for strFirstName, display the drop-down list and select
Ascending

8.

Click on the Apply Filter button To perform the sort.

9.

Scroll through the records

Records are displayed in order alphabetically by first and last names. When the last name is the same, as in the case of the Gordon employees, the records are sorted by the first name. To display the records in their original order.

10. Choose _Records_


_Remove_Filter/Sort_

11. Close the table If prompted, save changes to the table Close the database
3 - 20

Lesson 3: Working with tables

3 - 21

Access 2000: Level 1 (First Edition)

Practice Unit for Lesson 3


In this activity, you will enter data into a table and make changes to the table design. 1. 2. Open the database Workprac. Display the tblInventory table in Datasheet View. Enter the following information:

Id
CE1023 CE1275 MK0236 MS1645 3.

Equipment
Pentium PC Laser Printer Pentium PC Fax Machine

Serial Number
5251-874 PO63458 5123-354 TO/432

Purchase Date
11/3/98 10/14/95 2/1/97 5/1/97

Service
4 4 4

Price
899.00 425.00 999.00 795.00

Experiment with any of the following:


Edit a record; then use the Undo button. Use the Find feature to locate all Pentium PCs. Check the spelling of the Equipment field. Select record 3 and delete it. Add a new record. Copy some of the values from the previous record and insert the system date for the Date field. Use a filter to view only those records where service is checked. Remove the filter. Sort the records according to purchase date.

4.

Close the table. Close the database.

3 - 22

Lesson 3: Working with tables

Wrap-up for Lesson 3


a When does Access save the data you enter into a record?

Why might you want to modify the table design?

List ways to locate specific data values in a table.

What shortcut key combination do you use to copy values from the previous record?

How can you sort on more than one field?

Match each of the following labels to the correct toolbar button. __________ __________ __________ __________ Filter By Selection A. Sort Descending B. Remove Filter C. Sort Ascending D.

3 - 23

Using select queries

Lesson objectives
To get the information you want from your tables, you must design queries to extract the appropriate fields and values. To accomplish this, you will: a Create a query to view specific fields. b Refine the results of a query to view records that meet specific criteria.

c Create queries that perform calculations. d Join tables in a query.

4-1

Access 2000: Level 1 (First Edition)

a
Concepts >

Selecting fields and sorting records


What is a select query?
Many times, you do not need to see all the data in your table. You might want to see only certain fields, records, or both. Queries are the objects that you use to locate information stored in a table. To view only the data you want, use select queries; they enable you to select specific fields and records from a table. When you use a query, you must specify how you want the results to be displayed. By choosing the fields you want, and setting criteria for those fields, you can extract the precise information you want. For example, you might want to display only the names and phone numbers for people who work in the Marketing Department.

Task A-1: An introduction to query concepts


What you do
1. What is a query?

Comments/Prompts
________________________________________ ________________________________________ ________________________________________ ________________________________________

2.

What are some questions you might ask about data in the following databases: Dept. Of Motor Vehicles Employee list Police Dept. Records ________________________________________ ________________________________________ ________________________________________

3.

List some examples of possible queries on your data at work.

________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________

4.

Why would you want to save a query?

4-2

Lesson 4: Using select queries

Creating a query
Concepts > You create a query in the query Design View window. Select queries have three components:

The source of the data (for example, a table, multiple tables, or another query). The question (the query design). The design of your query tells Access what data to retrieve. The answer (the temporary result called the query Datasheet View). In Access, the result of a select query is placed in a temporary datasheet.

Human Resources Data table


Source data

Who are the employees in the RS department and what are they paid?

Query design

RUN

Query results

Figure 4-1: Creating a query.

Task A-2: Creating a query


q Objective: To create a new query based on the tblHumanResourcesData table.

What you do
1. Open the Query database Maximize the Database window 2. Open the tblHumanResourcesData table

Comments/Prompts

A new query will be based on this table, which includes 7 fields and 25 records.

4-3

Access 2000: Level 1 (First Edition)

3.

Display the New Object dropdown list Select Query

To create a new query. 4. In the New Query dialog box, verify that Design View is selected Click on OK

5.

Observe the upper pane of the query Design View window In the tblHumanResourcesData field list, click on the vertical scroll bar

The upper pane contains the field list of the table (or tables) on which the query is based. In this case, the field list is for the tblHumanResourcesData table. You can view all the tables fields by scrolling through the field list.

6.

Selecting fields to include in the query


Concepts > There is a direct relationship between what you place in the design grid and what is displayed in the query results. For a field to be displayed in the query results, you must drag the field from the field list to a column of the design grid. The fields are displayed in the query result in the same order as they are placed in the design grid.

4-4

Lesson 4: Using select queries

Task A-3: Adding fields to the design grid


q Objective: To view data from the strDept, strEmpId, and curPayRate fields for all records.

What you do
1. Observe the lower pane of the query Design View window

Comments/Prompts

The lower pane displays the design grid. Each column is a field that will be included in the query Datasheet View. 2. In the tblHumanResourcesData field list, select strDept and drag it to the first empty Field cell in the design grid Observe the mouse pointer 3. Release the mouse button Observe the Field cell 4. Click in the next empty Field cell Display the drop-down list To select the field strDept and add it to the query.

The mouse pointer changes to a field icon. To enter the strDept field name in the Field cell. It contains a button with a downward pointing arrow.

The drop-down list contains the tblHumanResources Data field list. Select strEmpID 5. Observe the Show check box To add the strEmpId field to the query. By default, the Show check box is selected. The strEmpId field will be displayed in the query Datasheet View.

Practice Task
Add the curPayRate field to the design grid.

4-5

Access 2000: Level 1 (First Edition)

Query results
Concepts > Once you have your query set up the way you want, you can run it. The results of a select query are placed in a temporary datasheet. You can navigate within the temporary datasheet as you would within any table. You can even edit the records and add new ones. Any changes you make are incorporated in the table on which the query is based.

Printing the results of a query


To print the query results, display the query in Datasheet View. Click on the Print button on the toolbar. You can preview your query results by clicking on the Print Preview button.

Task A-4: Running the query and observing the results


q Objective: To view the Dept, ID, and Pay Rate information for all records. Before you begin: Complete the Practice Task at the end of Task A-3.

What you do
1. Click on the Run button

Comments/Prompts

To run the query. 2. Observe the results The Dept Code, ID, and Pay Rate fields are displayed. All 25 records from the tblHumanResourcesData table are included in the query results. Records are in the order in which they are displayed in the tblHumanResourcesData table. 3. Click on the Print Preview button To preview the printed query results. 4. Click on Close To close the Print Preview window.

Sorting records
Concepts > You can sort records in a query the same way that you sort records in a table. Sorting records can make data easier to review and edit. For example, you might want to edit employee records in alphabetical order by last and first name. In a query, you can sort up to 10 fields.

4-6

Lesson 4: Using select queries

Task A-5: Sorting records in a query


q Objective: To order records primarily by the strDept field and secondarily by the strEmpId field. Sorting the results can help you find information quicker.

What you do
1. 2. Return to Design View In the design grid, in the column for strDept, click in the Sort cell Display the drop-down list and select Ascending

Comments/Prompts
(Use the View button.) In the design grid, each field column contains a Sort cell; clicking on that cell displays a downward pointing arrow that you can click on to display the drop-down list.

To sort the records in alphabetical order by department. 3. In the Sort cell for strEmpId, display the drop-down list and select Ascending Run the query and view the results Place the insertion point anywhere in the Dept Code field Click on the Sort Descending button 6. Observe the results The new sort order overrides the previous sort. To perform a second-level sort on Employee Id.

4. 5.

(Click on the Run button or the View button.)

Using criteria to select records


Concepts > You can select specific records to be displayed in a querys Datasheet View by entering criteria for one or more fields in the design grid. Criteria are conditions that identify the records you want to view. For example, you can use criteria to tell Access to find only the employees who live in a particular state. Each field column includes a Criteria cell. Criteria can require an exact match for a specific value. For example, entering a specific last name in the Criteria cell for the Last Name field causes the query Datasheet View to display only the records with that name; entering a department name criterion in the Criteria cell for the Department field causes the query Datasheet View to display records for only that department.

4-7

Access 2000: Level 1 (First Edition)

Task A-6: Using criteria to select records


q Objective: To view records for employees who work in the Relocation Services department.

What you do
1. 2. Return to Design View In the design grid, in the column for strDept, click on the Criteria cell Type rs Press R

Comments/Prompts

To enter a selection criterion.

3.

To select records where the value in the strDept field is RS (Relocation Services). The Criteria cell is not case sensitive.

Observe the Criteria cell 4. Run the query and view the results

Double quotation marks are entered around rs; you do not need to type them. Only records for employees in the RS department are displayed (five records). The IDs are in order because of the ascending sort specified.

Saving a query
Concepts > You can save the design of a query by choosing File, Save As or by clicking on the Save button. Each time you run the query, the query Datasheet View will include current data from the table.

Task A-7: Saving and naming the query


q Objective: To save the query design as an Access object.

What you do
1. Click on the Save button

Comments/Prompts
To display the Save As dialog box.

2.

Type qryMyRSEmployees Click on OK

4-8

Lesson 4: Using select queries

3. 4.

Close the query Close the tblHumanResourcesData table

4-9

Access 2000: Level 1 (First Edition)

b
Concepts >

Refining the results of a query


If the query does not give you the results you want the first time you run it, you can modify it by adding or deleting fields, by changing the field order, or by changing the criteria.

Task B-1: Adding fields to a query


q Objective: To add consecutive fields and one non-consecutive field to the design grid of an existing query.

What you do
1. 2. Display the list of query objects Select the query
qryParkingList

Comments/Prompts
(In the Object bar, click on Queries.)

Click on Design Examine the query design 3. In the upper pane, in the field list, select intHours Press S and select
curPayRate

The design grid contains the fields strEmpID, strParkingLotCode, and ysnHealth.

To select the fields intHours and curPayRate. (Use the Shift key to select consecutive fields from the field list.) To select the strDept field. (Use the Ctrl key to select non-consecutive fields from the field list.)

4.

Scroll to view strDept Press C and select strDept

5.

Place the mouse pointer on one of the selected fields Drag the field icon to the next empty Field cell in the design grid To add the selected fields to the query. (You might need to scroll.) Fields are in the order in which they were added to the design grid. (Click on the Run button.) Fields are displayed in the query Datasheet View in the order in which they are displayed in the table (primary key order) because no sorting is specified in the query design grid.

6.

Observe the order of the columns in the design grid Run the query

7.

Observe the results

4 - 10

Lesson 4: Using select queries

8.

Choose _File_ _Save_As..._ Type qryMyParkingCodes Press R

To display the Save As dialog box and rename the changed query.

9.

Close the query

Using operators in query criteria


Concepts > In addition to an exact match criteria, you can also select records using an expression that includes an operator. Operators are often used to define a range of values for the criteria. A common Access operator is the wildcard. You can use the asterisk wildcard to select a group of records. The asterisk substitutes for a group of characters.

Task B-2: Selecting records with a wildcard operator


q Objective: To view records for only those employees whose last names begin with the letter M.

What you do
1. 2. Open the qryEmployeeNames query Display the View menu

Comments/Prompts
Employees are listed by ID. (Click on the down arrow next to the View button.)

Queries have three view options. The data is currently in Datasheet View. SQL View displays the SQL code behind the query. Datasheet View is the default. Select Design View 3. In the column for strLastName, click in the Criteria cell Type m* Press R To select records for employees whose last names begin with the letter M. Text searches are not case sensitive. To view the design of the query.

4 - 11

Access 2000: Level 1 (First Edition)

4.

Observe the Criteria cell

The like operator and double quotation marks are entered automatically when you use a wildcard. 5. 6. Run the query and observe the results Close the query without saving changes Only records for employees whose last names begin with M are listed (five records).

Comparison operators
Concepts > Criteria expressions often involve one or more values and one or more operators. Most operators limit the selection of records to a specific ranges of values. Comparison operators are useful when you want to compare the values in a field with a predefined value.

Compariso n operators
< > = <= >= <>

Meaning
Less than Greater than Equal to Less than or equal to Greater than or equal to Not equal to

Task B-3: Selecting records with a comparison operator


q Objective: To view records for those employees who make less than $18.00 per hour.

What you do
1. 2. Open the qryPayRates query Change to Design View

Comments/Prompts
There are 25 records.

4 - 12

Lesson 4: Using select queries

3.

In the column for curPayRate, click in the Criteria cell Type <18 Press R

(You might have to scroll to view curPayRate.) To select records with values less than $18.00 in the curPayRate field.

4.

Run the query and view the results

Only records with pay rates less than $18.00 per hour are listed (5 records).

Multiple criteria
Concepts > You can use the logic operators, such as AND and OR, to establish multiple criteria within the same field.

AND conditions
An AND condition requires that two or more criteria must be true for the records to be included in the result. In the design grid, you can create two basic types of AND conditions: AND conditions that contain criteria in multiple fields, and AND conditions that contain multiple criteria in one field. You can create an AND condition for more than one field by entering criteria on the same row of the grid. For example, entering the criterion MK for the Department field and <40 for the Hours field causes Access to select only those records that meet both conditions (people who work in the Marketing Department and who work fewer than 40 hours per week). To define an AND condition within one field, type the word AND in its Criteria cell between the criteria. For example, the criteria >10 and <20 in the Criteria cell for the Hours field selects records of employees who worked more than 10 and less than 20 hours.

Task B-4: Using an AND condition


q Objective: To view records for employees who work in the Training And Development department and who earn more than $16.00 and less than $23.00 per hour.

What you do
1. 2. Return to Design View In the Criteria cell for strDept, type td Press R

Comments/Prompts

The criteria are that the department code be TD and the pay rate be less than $18.00.

4 - 13

Access 2000: Level 1 (First Edition)

3.

Run the query and view the results Return to Design View In the column for curPayRate, change the criteria to >16 and <23 Press R

The datasheet displays the records of employees who work in the Training And Development department and who earn less than $18.00 per hour (one record).

4.

So the values displayed in the query Datasheet View will be between $16.00 and $23.00 per hour. Three records are listed for employees who work in the Training And Development department and who earn more than $16.00 and less than $23.00 per hour.

5.

Run the query and view the results

OR conditions
Concepts > An OR condition requires that at least one condition must be true for the records to be included in the result. In the design grid, the OR row is directly under the Criteria row. Entering criteria in this row creates an OR condition. For example, for the State field, entering NY in its Criteria cell and then CA in its OR cell selects those records that have New York or California as the state. As with AND conditions, you can use OR conditions in more than one field. For example, entering NY in the Criteria cell for the State field and TD in the OR cell for the Department field causes Access to select those records for people who live in New York or who work in the Training And Development department.

4 - 14

Lesson 4: Using select queries

Task B-5: Using an OR condition


q Objective: To select only those records for employees who work in the Marketing (MK) or Training And Development (TD) departments, or who work less than 30 hours.

What you do
1. Return to Design View In the curPayRate and strDept columns, delete the criteria 2. In the column for strDept, click in the Criteria cell Type mk Sort in ascending order by department 3. In the column for intHours, click in the OR cell Type <30 4. Observe the design grid

Comments/Prompts

(Select the criteria; then press the Delete key.)

Sorting will help you verify that the query results are accurate.

The criteria (MK for strDept and <30 for intHours) are on two different rows. 5. Run the query and view the results Return to Design View In the column for strDept, click in the Criteria cell to the right of MK 7. Press s Type or td Press R 8. Run the query and view the results To select records with a value of MK or a value of TD in the strDept field. Sixteen records are listed for employees who work in the MK or TD departments or who work fewer than 30 hours per week. To place the insertion point in the cell. The records listed are for employees who work in the Marketing Department or who work fewer than 30 hours per week (12 records).

6.

4 - 15

Access 2000: Level 1 (First Edition)

Null values
Concepts > Some records might not have a value for the fields you query. When a record does not have a value in a field, Access treats this value as null. Null values are not included in calculations, nor are they allowed in primary key fields. You can use the Is operator to determine if the value in a field meets a certain condition; for example, Is Null determines if a field is empty, and Is Not Null determines if a field contains any value.

Task B-6: Selecting records with empty fields and saving the query
q Objective: To view records for employees who have not been assigned to a parking lot.

What you do
1. Return to Design View Delete the criteria in the intHours and strDept columns 2. In the column for strParkingLotCode, in the Criteria cell, type is null Press R 3. 4. 5. Run the query and view the results Choose _File_ _Save_As..._ Type qryMyNullParking Click on OK

Comments/Prompts

To select records where no value has been entered in the strParkingLotCode field. The strParkingLotCode field is blank for each of the three records. To display the Save As dialog box. To name and save the query.

4 - 16

Lesson 4: Using select queries

Editing values
Concepts > The query Datasheet View is a dynamic set of recordswhen you edit the records in it, the corresponding values in the underlying table are changed.

Task B-7: Editing values in the query result and viewing the table
q Objective: To enter data in the query results instead of in the underlying table.

What you do
1. In the datasheet, add the following parking codes: EN1-38: WI EN1-27: MA 2. 3. Close the query Open the qryMyNullParking query Close the query 4. Open the tblHumanResourcesData table View the records for EN1-27 and EN1-38 5. Close the table Close the database

Comments/Prompts

Only one record contains a null value in the strParkingLotCode field and is therefore included in the query results. The parking lot codes that you added in the query Datasheet View have been saved in the tblHumanResourcesData table. The parking codes have been updated.

4 - 17

Access 2000: Level 1 (First Edition)

c
Concepts >

Using queries to perform calculations


Not only can you use queries to select, sort, and display data in a table, you can also use them to perform calculations on each record in your table. Calculating and summarizing the data enables you to review and analyze trends.

Using calculations in queries


Because tables can get very large, you should not include data in your tables fields that can be calculated from other fields. It is often more efficient to use a calculated field than it is to store the information in the table. For example, if your table includes the fields intHours and curPayRate, you do not need to include curGrossPay as a separate field. To see gross pay information for individual records, you can create a query that calculates gross pay. By creating a query, you save space, reduce data-entry effort, and increase the overall performance of Access.

Task C-1: Using calculations in queries


q Objective: To discuss the reasons why you would calculate data in a query.

What you do
1. Why would you use calculations in queries?

Comments/Prompts
________________________________________ ________________________________________ ________________________________________

2.

Give some examples of ways that you might analyze data in the following fields: intHours curPayRate ________________________________________

________________________________________

3.

Give some examples of calculations that can be done from the following pair of fields: intHours, curPayRate ________________________________________ ________________________________________ ________________________________________ ________________________________________

4.

Give some examples of calculations that you will need to perform in queries from your data at work

4 - 18

Lesson 4: Using select queries

Calculated fields
Concepts > You can perform a horizontal calculation on data in each record in a table by adding a calculated field to the design grid. To create a calculated field, you enter an expression in a Field cell. An expression is any combination of functions, field names, numbers, text, and operators that calculates a result. The expression describes the calculation you want to perform. If the expression includes field names, you must enter square brackets around each field name. The expression can include the following arithmetic operators:

Operator symbol
* + / ^

Arithmetic function
Multiplication Addition Subtraction Division Exponentiation

For example, to multiply intHours by curPayRate, you enter the expression [intHours]*[curPayRate]. When you enter an expression in a Field cell, Access supplies a default column name such as Expr1. You can replace this name with a more meaningful name, such as curTotalPrice for the expression [intQuantity] * [curUnitPrice]. The syntax for a calculated field is column name: expression.

Task C-2: Creating and naming a calculated field


q Objective: To calculate the gross pay for each employee.

What you do
1. Open the Calc database If necessary, maximize the Database window 2. In the Database window, display the list of query objects

Comments/Prompts

There are none.

4 - 19

Access 2000: Level 1 (First Edition)

3.

Click on the New button Verify that Design View is selected Click on OK To create a new query.

The Show Table dialog box is displayed. From here you can select the table or query that you want to base the new query on. 4. Select
tblHumanResourcesData

To base the query on this table.

Click on Add In the Show Table dialog box, click on Close 5. Add the intHours, curPayRate, and strDept fields to the design grid In the next blank column, click in the Field cell Type [intHours]*[curPayRate] Press R 7. At the division line to the right of the calculated field column, place the insertion point on the gray bar and double-click The entire expression is now visible. 8. Run the query and view the results The Expr1 calculated field is displayed. To calculate the weekly gross pay (hours multiplied by pay rate). You must enclose field names in square brackets. To include these fields in the result.

6.

4 - 20

Lesson 4: Using select queries

9.

Change to Design View In the column for the calculated field, double-click on Expr1 Type Gross Pay Adjust the column size to fit the entire expression To select and rename the calculated field.

10. Run the query and view the results 11. Save the query as
qryMyGrossPay

The calculated field is named Gross Pay.

Calculating summaries on groups of records


Concepts > You can also use a select query to perform vertical calculations on records in a table. This type of calculation summarizes data in individual fields in a table by using aggregate functions. The following table indicates the type of calculations you can perform to summarize data:

Type of summary calculation


Sum Avg Min Max Count StDev Var First Last

Description
Adds the values. Calculates the average value. Finds the smallest value. Finds the largest value. Counts the number of values, excluding empty values. Calculates the standard deviation. Calculates the variance Finds the value of the first record Finds the value of the last record

To create a query with totals, determine which fields to group and which summary operation to perform. The result of a query with totals cannot be edited.

4 - 21

Access 2000: Level 1 (First Edition)

Task C-3: Calculating a total for a group of records


q Objective: To summarize the data to determine the total gross pay for each department.

What you do
1. Change to Design View Click on the Totals button

Comments/Prompts

To summarize data. Observe the design grid

A Total row is added to the grid, and Group By is included for each field. The Group By operator under strDept causes Access to perform the calculation for each department. 2. Above the intHours field, click on the gray box Press D Select and delete the curPayRate column from the design grid 3. 4. In the column for Gross Pay, click in the Total cell Display the drop-down list Observe the summary operators To display the drop-down arrow. To view a list of calculations you can perform. To select the intHours field. To delete the intHours column from the design grid.

Select Sum 5. Run the query and view the results

To total Gross Pay.

Access calculates the total gross pay for each department. 6. 7. Save the query as
qryMyTotals

Close the query

4 - 22

Lesson 4: Using select queries

d
Concepts >

Joining tables in a query


Pulling data from more than one table at a time enables you to get the most out of your database. Whenever you construct a query involving two or more tables, you must tell Access how to join (or link) the information in the tables.

Task D-1: An introduction to joining concepts


q Objective: To discuss the reasons why you would join two tables in a query.

What you do
1. 2. Why would you join tables in a query? Give some examples of joins that you might need to define in your queries at work

Comments/Prompts
________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________

Joining tables automatically


Concepts > Access automatically joins two tables if they each contain a field with the same name and data type, and if this field is the primary key in at least one of the tables. The join line is displayed in the upper pane of the query Design View window.

Task D-2: Joining two tables in a query


q Objective: To join two tables to establish a temporary relationship for the purpose of the query.

What you do
1. 2. 3. Create a new query in Design View Add the tblPersonalData table to the query Add the tblHumanResourcesData table to the query Click on Close

Comments/Prompts
The Show Table dialog box is displayed.

To add the second table to the query.

To close the Show Table dialog box.

4 - 23

Access 2000: Level 1 (First Edition)

4.

Observe the join line between the tblPersonalData and tblHumanResourcesData tables

The tables are joined on strEmpID. Access automatically joins two tables if they each have a field with the same name and data type and at least one of the fields is a primary key. 5. From the tblPersonalData table, add the strEmpID, strFirstName, and strLastName fields to the design grid From the tblHumanResourcesData table, add the intHours, curPayRate, and strDept fields to the design grid In the design grid, observe the Table row When a query is based on multiple tables, you can tell what table the field is from. 8. Run the query and observe the number of records in the results Save the query as qryMyJoin Return to Design View The employee names are listed along with their hours and pay rates. There are 25 records. Each table has 25 records.

6.

7.

9.

Joining tables manually


Concepts > If the tables in your query do not have an established relationship, or a common field with the same name and data type, you must create the link by dragging a field from one table to the matching field in the other table. This type of join applies only to the query and does not establish a permanent relationship between the tables.

Removing joins in queries


If you need to delete the join between tables in a query, right-click on the join line between the tables. From the shortcut menu, choose Delete (or, from the main menu, choose Edit, Delete). Or, in query Design View, select the join line and then press the Delete key. Deleting a join line in a query affects only that query.
4 - 24

Lesson 4: Using select queries

Task D-3: Creating a join in query Design View


q Objective: To add a third table to the query to display full department names. Before you begin: The new query created in Task D-2 is open in Design View.

What you do
1. Click on the Show Table button

Comments/Prompts

To display the Show Table dialog box. Add the tblDepartment table Close the Show Table dialog box 2. In the tblHumanResourcesData field list, place the mouse pointer on the strDept field Drag strDept from tblHumanResourcesData to the strDeptCode field in the tblDepartment field list Two tables can be joined by fields of the same data type which contain common values.

3.

From the tblDepartment field list, add the strDeptName field to the design grid Run the query and view the results Save the query as Close the query Close the database
qryMyDepartmentNames

To add another field to the query Datasheet View.

4. 5. 6.

The results include the full department name. This data is drawn from the third table.

4 - 25

Access 2000: Level 1 (First Edition)

Practice Unit for Lesson 4


In this activity, you will create queries to calculate information and view data from three tables. 1. 2. Open the database Calcprac. This database is used by a fictitious book bindery business. Open each of the tables in the database:

The tblCustomers table stores one record for each customer with identifying information. The tblBookOrders table stores information about each order placed. Observe that the book title is not stored in this table. The tblBooks table stores information about each book. Close the tables.

3.

Create a query in Design view that links the tblCustomers table to the tblBookOrders table. Add the strCustomerName, intQuantity, and strBookNumber fields to the design grid. Run the query and view the results. Return to the query Design View and add the tblBooks table to the query. Observe the common field between the tblBookOrders and tblBooks tables. Add the strTitle field to the design grid. Calculate the total price each customer owes for each book order. (Multiply the quantity ordered by the book price.) Change the default calculated field name to Order Cost .

4. 5.

6. 7. 8.

Run the query. Save the query as qryMyBooks Close the query. Close the database.

Figure 4-2: The qryMyBooks design grid.

4 - 26

Lesson 4: Using select queries

Wrap-up for Lesson 4


Where are the results of a select query placed?

List two of the ways to include specific fields in a query.

Fill in the criterion for the fields below to display all books with the sales price less than $25.00. Part Number Book Title Development Cost Sales Price ___________

Fill in the criteria for the fields below to display all books that begin with the letter S in the title and sell for more than $20.00 Part Number Book Title __________ Development Cost Sales Price ___________

What is the default column name in the query Datasheet View for a calculated field?

How can you change the default calculated field name?

Define joining tables.

When would Access automatically display a join line between two tables in a query?

How do you create a relationship between two tables in a query?

4 - 27

Creating and using forms

Lesson objectives
To create and use forms for viewing and entering data, you will: a Create a form by using the Form Wizard. b Modify a form by working with controls and control properties.

c Use a form to find, sort, and filter records. d View a multiple-table form.

5-1

Access 2000: Level 1 (First Edition)

a
Concepts >

Creating a form
By using a form, you can customize the display of data in a table or query. Forms that contain selected fields are usually designed to display one record at a time. You can select certain fields for display on the form, and you can add a title to the form. You can also print records from a form. To help you create forms, Access provides a Form Wizard. The Form Wizard prompts you to answer questions about the form that you want to create and builds the form based on your answers.

Figure 5-1: The completed form after Topic A.

Task A-1: Selecting the data source and adding fields


q Objective: To start the Form Wizard and specify the source table and the fields to display.

What you do
1. Open the Forms database If necessary, maximize the Database window 2. Display the list of form objects

Comments/Prompts

There are two form objects.

5-2

Lesson 5: Creating and using forms

3.

Click on the New button To display the New Form dialog box. (Alternately, from the Database window you could select Create Form By Using wizard.)

4.

Select Form Wizard In the Choose The Table Or Query Where The Objects Data Comes From text box, display the drop-down list Select tblPersonalData Click on OK

5.

From the Tables/Queries drop-down list, select the table tblPersonalData In the Available Fields list, verify that strEmpID is selected Click on > To add the strEmpID field to the form. To remove the strEmpID field from the form. To add all the fields to the form. To advance to the next dialog box.

6.

7. 8.

Click on < Click on >> Click on Next>

Form layouts
Concepts > By using the Form Wizard feature, you can create four types of forms:

Columnar: A form that displays the values in a record in one column, with each field on a separate line. This form displays one record at a time. Tabular: A form that displays the values in records in row and column format. This form displays multiple records at a time. Datasheet: A form that displays the values in records the same way as they are displayed in Datasheet View. Justified: A form that displays the values in records in paragraph fashion. Access adjusts the spacing between fields so that they are aligned evenly along the left side of the form, stretch out along the form, and are aligned evenly at the right side.

5-3

Access 2000: Level 1 (First Edition)

Task A-2: Choosing a layout


What you do
1. Observe the Form Wizard

Comments/Prompts
Columnar Layout is selected. Fields are displayed along the left side of the page. Only one record can be viewed at a time.

2.

Select Tabular Observe the layout Fields are displayed across the top of the page. Multiple records can be displayed on a single page.

3.

Select Datasheet Observe the layout Fields are displayed across the top of the page with record numbers displayed along the left side. Multiple records can be displayed on a single page. To select a layout option. To advance to the next dialog box.

4.

Select Columnar Click on Next>

Form style
Concepts > Ten form styles are available. The style describes the background, color, and format for labels and data.

Form name
The name of a form is displayed when the Forms button of the Database window is active.

Task A-3: Selecting the form style and naming the form
What you do
1. 2. 3. Observe the dialog box View the other choices Select SandStone Click on Next > 4. Observe the dialog box To use the SandStone format. To advance to the next dialog box. The title of the form is the name that is displayed when the Forms button is active in the Database window. By default, the name of the object on which the form is based is entered and selected.

Comments/Prompts
The Standard style is selected.

5.

In the What Title Do You Want For Your Form textbox, type
frmMyEmployeeData

To enter a name and save the form.

5-4

Lesson 5: Creating and using forms

5-5

Access 2000: Level 1 (First Edition)

Task A-4: Viewing data by using the form


What you do
1. Observe the dialog box Verify that Open The Form
To View Or Enter Information is selected

Comments/Prompts

You can view the design of the form or open the form and view the data. 2. 3. Click on Finish Observe the Form View window To open the form and view the data. The form displays all the field names from the table you selected. The field names are displayed in the order in which they were added to the form. Record 1 is displayed. The name of the form is displayed in the title bar.

Navigating in forms
Concepts > Moving through the records in a form enables you to review or edit information. The Form View window contains navigation buttons in the lower left corner. Vertical and horizontal scroll bars are displayed only if they are necessary to view the entire form.

Task A-5: Navigating in a form


What you do
1. Click on the Next Record navigation button To view the next record of information (the record for Gayle Murray). 2. Click on the Last Record navigation button To move to the last record in the table (record 25: Dana Smart). 3. Click on the First Record navigation button To move to the first record in the table (record 1: Carol Schaaf).

Comments/Prompts

5-6

Lesson 5: Creating and using forms

Using forms to enter and edit data


Concepts > When your form is displayed, you can enter and edit data. You can see the blank record in a form by clicking on the New Record button on the toolbar. Adding a record enables you to insert new information into your form. You can change data in a record to correct a mistake or update the data. You should save your form as soon as possible after creating it.

Task A-6: Entering data into a form


What you do
1. 2. Click on the New Record button Type EN1-99 Press R 3. Fill in the individual fields by using data about yourself

Comments/Prompts
The new record 26 is displayed. To fill in the Employee ID for the new record. Use Enter or Tab to move from one field to the next. Use the same techniques that you would in the datasheet. The record will be saved automatically.

5-7

Access 2000: Level 1 (First Edition)

b
Concepts >

Modifying the form design


After you have used a Form Wizard to create a form, you can modify the forms design to meet your needs. The most common reason for changing the design is to make the form look similar to an equivalent paper form; another reason is to make the form more interesting. You can switch between Form View and Datasheet View by displaying the dropdown list for the View button and choosing Datasheet View. The datasheet and the form include the same fields. The Design View enables you to change the design of a form. For instance, you can customize the form to make it easier to use or to enhance its appearance.

Form controls
Each part of the form design is an object called a control. The labels, text boxes, header section, detail section, and the form itself are controls.

Task B-1: An orientation to the form Design View


What you do
1. Change to Design View If necessary, maximize the window Close the toolbox Close the field list 2. Observe the form sections By default, the toolbox is displayed in Design View. By default, the field list is displayed in Design View.

Comments/Prompts
To view the design of the frmMyEmployeeData form.

The Form Header is the top section of the form. You can use this area to enter a title for the form. The Detail section takes up the majority of the form design window. It is where the fields and their labels are displayed. The Form Footer is the bottom section of the form. You can use this area to include a page number or other information.

Observe the objects on the form

These objects are called controls.

5-8

Lesson 5: Creating and using forms

3.

Observe the label controls

The Form Wizard creates a label and a text box for each field. The labels identify the fields. Each label control is to the left of its associated textbox control. 4. Observe the text boxes controls The field names are included in text boxes. The text boxes get the data from the fields in the underlying (source) table. This is where data is entered and displayed.

Working with controls in the form design


Concepts > You can change the location of a control on a form. In this way, you can change the order of information on the form. You can also change the size of controls on a form, or delete a control. As you modify controls in your forms, you need to know how to select a control. You can select the text box control or the attached label control. There are two types of controls:

Control type
Bound controls Unbound controls

Description
Text boxes on a form; windows that enable you to view data; can be deleted, moved, or sized. Labels on a form; not linked to fields in the underlying table or query; can be edited, moved, or deleted.

Figure 5-2: The design of the form after Task B-2 is completed.

5-9

Access 2000: Level 1 (First Edition)

Task B-2: Selecting and working with controls


q Objective: To change the default placement of the labels and fields on the form.

What you do
1. Select the label control
dtmHireDate

Comments/Prompts

(Click on it.) Boxes are placed around the edges of the selected control. Press D Click on the Undo button You can delete a label without deleting its associated text box.

The label is placed back on the form. 2. Select the text box control for dtmHireDate

Click on the text box to select both the field and its label. To delete the dtmHireDate text box and its label. To select the strLastName text box and its label. This is called the move handle. The mouse pointer changes to a hand with a pointing finger when you place it on the handle.

Press D 3. 4. Select the text box control for strLastName Place the mouse pointer on the large square in the upper left corner of the text box control

5.

Drag the control to the right on the form Click on the Undo button

The pointing finger moves only the selected control. The width of the form expands to hold the field.

6.

Place the mouse pointer on the bottom edge of the strLastName text box control, between the selection handles Drag the control to the right of the first name controls on the form

The mouse pointer changes to an open hand.

7.

The open-hand pointer moves the control and its label together. The width of the form expands to hold the label and text box.

Practice Task
Use Figure 5-2 as a guide to move the controls on the form.

5 - 10

Lesson 5: Creating and using forms

Resizing a control
Concepts > The Form Wizard rarely makes the form fields the proper size. You can size your fields and any other controls to the dimensions you want. For example, changing the size of a control enables you to display longer entries.

Task B-3: Sizing and aligning controls


q Objective: To change the size of the Last Name label and move the data text box closer to the label. Before you begin: Complete the Practice Task at the end of Task B-2.

What you do
1. 2. Select the control for the label strLastName Place the mouse pointer on the center sizing handle on the right side of the control

Comments/Prompts
Click once on the control that contains the label text strLastName.

The mouse pointer changes to a two-headed arrow when you place it on a sizing handle. To shorten the control for the label.

3.

Use the sizing handle to drag the edge of the control approximately one-half inch to the left Move the strLastName text box control approximately one-half inch to the left With the text box control for strLastName selected, press S and select the Last Name label, First Name text box, and First Name label Release S

4.

(Use the move handle in the upper-left corner of the text box control.) The mouse pointer must be a pointing finger to move one control. To select multiple controls.

5.

6.

Choose _Format_ _Align_


_Bottom_

To align the bottom edge of the selected controls relative to each other. The selected controls align to the bottom-most control.

Form control properties


Concepts > Each of the controls displayed in your forms has a set of properties that determine the general appearance and behavior of that control. Each kind of control has a slightly different set of properties that can be customized on the property sheet. For instance, by changing the format of a field, you can customize the way text, numbers, dates and times are displayed on a form.

5 - 11

Access 2000: Level 1 (First Edition)

Task B-4: Viewing and changing control properties


q Objective: To change settings on the property sheet to affect the way text is displayed for the ID label and the Last Name field.

What you do
1. Select the label strEmpId Click on the Properties button

Comments/Prompts

(Or, while pointing to the label control, right-click and choose Properties.) To view the property sheet for the label strEmpId. 2. Verify that the All tab is active To view all the properties of the label.

Observe the Name property 3. Select the Caption text and type Employee Id Press R 4. 5. Observe the label on the form Select the text box control for strLastName Observe the Control Source property 6. 7. Scroll to view the Font Weight property Display the Font Weight drop-down list Select Semi-Bold 8. Close the property sheet

Access names the label. To change the caption text.

It is updated to reflect the new text. (You might need to drag the property sheet out of the way.) The Control Source property shows that the data comes from the field in the underlying table. Therefore, it is a bound control. It is Normal.

To change the text attributes of the control.

5 - 12

Lesson 5: Creating and using forms

Adding a title to the form


Concepts > The Form Wizard creates a Detail section. The Detail section contains data from the record source. The Form Header is displayed at the top of the form; it is an ideal place for form titles or data headings. You can add titles to a form by adding a label control.

The toolbox
The toolbox is a floating toolbar that contains buttons representing the objects that you can place inside the form, such as labels and textboxes. You can toggle the display of the toolbox on and off by using the Toolbox button or by choosing View, Toolbox.

The Formatting toolbar


The Formatting toolbar gives you quick access to many of the design features that are useful to forms. For instance, if you want to change the font used in a control, the toolbar provides drop-down lists and buttons that enable you to do so.

Task B-5: Adding a title to the form


q Objective: To add a label to the Form Header.

What you do
1. Place the mouse pointer between the Form Header and the Detail section Drag the Form Header down about one-half inch Click on the Toolbox button

Comments/Prompts

The mouse pointer becomes a two-headed arrow. To open the Form Header section.

2. 3.

(Or choose View, Toolbox.) To display the toolbox.

If necessary, drag the toolbox off the Form Header

5 - 13

Access 2000: Level 1 (First Edition)

4.

In the toolbox, click on the Label tool Place the mouse pointer in the Form Header The mouse pointer changes to a crosshair connected to the letter A.

5.

Click once in the Form Header Type Employee Data Form Press R

To enter the text and select the text box.

6.

On the Formatting toolbar, display the Font Size dropdown list Select 18

To display available font sizes.

7.

Choose _Format_ Extend the menu Choose _Size_ _To_Fit_

To display the title in the text box. (If necessary.) The Size command is not included in the short menu. When you extend the menu, more commands are displayed; choosing one adds to the basic menu.

Practice Task
In the Form Header section, move the label so that it is displayed as centered over the form.

Previewing a form
Concepts > You can preview your form before printing it. To preview a form from Design View, Form View, or Datasheet View, click on the Print Preview button on the toolbar. Depending on the view from which you preview it, a form is displayed in Print Preview in different ways.

5 - 14

Lesson 5: Creating and using forms

Task B-6: Saving and viewing the form; previewing the printed form
What you do
1. Click on the Save button To save the modified form design. 2. Change to Form View Observe the form The dtmHireDate field is deleted. The strLastName, strAddress, strCity, strState, strZip, and strPhone fields are in a new location. A title is added to the form.

Comments/Prompts

3.

Click on the Print Preview button To preview the form as it will print.
Note: If you worked in Design View and widened a

section of the form to a width that is greater than what can be printed on a single page, you will be alerted by the program. In that case, you can return to Design View to adjust the size of the section if you desire. 4. Click once on the form To zoom the form. The header prints on top of the first page. Several records print continuously until page 1 is filled. The remaining records continue on additional pages.

5.

Click on Close To close the Print Preview window.

Figure 5-3: The completed form.

5 - 15

Access 2000: Level 1 (First Edition)

c
Concepts >

Using a form to locate and organize information


Finding a record in a form
You can find a record by using a form the same way that you do in the datasheet. To hasten this process, make sure that the field containing the information you want is active before you choose Edit, Find or click on the Find button. For example, if you are looking for a specific hire date, make sure the appropriate field is active before you begin the search to limit it to only that field.

Task C-1: Finding a record


q Objective: To find a specific last name in a form.

What you do
1. 2. Place the insertion point in the strLastName text box On the toolbar, click on the Find button

Comments/Prompts
To make the Last Name field the current field.

Move the Find And Replace dialog box to the lower-right corner of the screen 3. 4. 5. 6. In the Find What text box, type Zumbo Click on Find Next Observe the record In the Find And Replace dialog box, click on Cancel

To display the Find And Replace dialog box. The last search value used is selected in the Find What text box.

To find Barbara Zumbos record.

Barbara Zumbos record is displayed. To close the Find And Replace dialog box.

5 - 16

Lesson 5: Creating and using forms

Sorting records
Concepts > You can sort records in a form to display them in a different order than that of the underlying table.

Task C-2: Sorting records in a form


q Objective: To sort the records by zip code.

What you do
1. 2. Place the insertion point in the strZip text box Click on the Sort Ascending button

Comments/Prompts

To sort in ascending order by zip code. 3. Click on the Next Record navigation button several times Choose _Records_
_Remove_Filter/Sort_

To view the records in ascending order by zip code. To return records to their original order. The records are in order by the ID field because that is the primary key.

4. 5.

Click on the Next Record navigation button several times

Filtering records
Concepts > To create a custom view of your data, you can use the Filter By Form button to set conditions that records must meet to be displayed. This filters out records that are not relevant to a specific task. For example, you might want to see the records for employees in a specific department or orders that fall within a certain range of dates. You specify filter criteria in the same way that you specify query criteria, and you can use the same comparison operators.

Removing a filter
The filter remains in effect in both Form View and Datasheet View until you close the Form window or until you click on the Remove Filter button.

5 - 17

Access 2000: Level 1 (First Edition)

Task C-3: Creating and applying a form filter


q Objective: To apply a filter to view only New York state residents.

What you do
1. Click on the Filter By Form button

Comments/Prompts

To display an empty form. 2. Place the insertion point in the strState text box Display the drop-down list Select NY 3. Click on the Apply Filter button To view the records that correspond to the filter criterion. 4. Observe the status area Use the navigation buttons to view the records 5. Click on the Remove Filter button All records are displayed in their original order. 6. Close the form The filter is removed. The filter is applied to limit the number of records. The records for people living in New York are displayed. To prepare to filter records where the value in the strState field is NY. To display a list of states that are stored in the table. The drop-down list includes the value you added for your own record.

5 - 18

Lesson 5: Creating and using forms

d
Concepts >

Multiple-table forms
You can base a form on a query if you want to join tables, sort records, or select records automatically when the form is opened. A convenient way to display calculated data in a form is to create the calculated field in a query, then include the calculated field in the form.

Task D-1: Viewing a multi-table query


What you do
1. Open the qryEmployeeInformation query and view the results Change to Design View Observe the query design

Comments/Prompts
Selected fields from four tables are displayed. The last field, gross pay, is a calculated field. Four tables are joined. Specific fields from each table are in the design grid. The strLastName field is sorted in ascending order. A calculated field for gross pay is at the end of the design grid.

2.

3.

Close the query Design View window

Record source
Concepts > You cannot determine which object a form is based on by viewing it. However, you can tell whether the form is based on a table or query by checking the Record Source property. If the form is based on a multiple-table query, it most likely displays only some of the fields from each of the source tables (not all of them). Therefore, you can view and edit data by using the form, but you may want to avoid adding new records by using the form. If all fields from the source tables are not displayed in the form, then you do not have access to everything, so some information will be left out. Also, when you have a form based on a multiple-table query, you should use caution editing the values in the form. For example, Figure 5-4 shows a form that contains data from four separate tables. The Parking Lot and Parking Lot Fee values come from the tblParkingInformation table. If you changed the Parking Lot Fee for one employee record, that change would be recorded in the source table, and you would change the data for everyone assigned to that parking lot. When dealing with multiple tables, it is best to edit the source tables and use the form to display and view related information.

5 - 19

Access 2000: Level 1 (First Edition)

Figure 5-4: The multiple-table form.

Task D-2: Viewing a multi-table form and checking the record source
q Objective: To view the source from which the form is getting the data.

What you do
1. Open the frmEmployeeInformation form Use the Next Record navigation button to view several records

Comments/Prompts

2.

The label names are descriptive. Records are in alphabetical order by last name. The fields are from several different tables, but not all fields from each table are on the form. The Gross Pay data is calculated.

3.

Change to Design View

5 - 20

Lesson 5: Creating and using forms

4.

Display the property sheet To view properties for the whole form.

Observe the Record Source property 5. 6. Close the form Close the database

The record source is the multi-table query, qryEmployeeInformation.

5 - 21

Access 2000: Level 1 (First Edition)

Practice Unit for Lesson 5


In this activity, you will create a form by using the Form Wizard. 1. 2. Open the database Formprac and display the list of form objects. Use the wizard to create a new form based on the tblBookOrders table. Include the fields Customer, Book Title, Date, and Quantity. Use the Columnar layout for the form. Choose a form style you like. Save the form with the title
frmMyBooks

3. 4. 5.

Modify the design to put the labels and field controls for Date and Quantity on the same line. Use the Format, Align control if you like for greater precision. Change the Caption property of each label to match the label text in Figure 5-5. Add the title Book Sales in the Form Header. Format the label as 18-point, italic. Adjust the size of the control to fit the text. Save the modified design and view the form. Use the Sort buttons to sort the records by Book Title in ascending order. View the records. Remove the sort order. Save changes if prompted. Close the form. Close the database.

6. 7. 8. 9.

Figure 5-5: A sample completed form (using the Ricepaper style).

5 - 22

Lesson 5: Creating and using forms

Wrap-up for Lesson 5


a When would you use a columnar form?

What button do you use to add a new record to a form?

What are some of the ways that you can modify a form?

What are two ways you can organize your data while using a form?

What are some reasons for basing a form on a query?

5 - 23

Creating and using reports

Lesson objectives
To present data from your tables, you will need to generate reports. To create and use reports, you will: a Create a standard report with data in rows and columns. b Create a report that groups information by categories and includes summary information.

6-1

Access 2000: Level 1 (First Edition)

a
Concepts >

Creating a report
Although you can print datasheets and forms in Access, creating reports usually makes your data more presentable and meaningful. You can specify the fields that you want to include, and organize the data by grouping and sorting the records. You can also include summary calculations in your reports. The Access Report Wizard prompts you with questions and uses your responses to create a report based on a table or a query that you designate.

Figure 6-1: The grouped and sorted report in Print Preview mode.

Task A-1: Creating a report and selecting the data source


What you do
1. Open the Reports database Maximize the Database window 2. 3. 4. Display the list of report objects Click on New In the New Report dialog box, select Report Wizard There are none. (Or, from the Database window, select Create Report By Using Wizard.) To create a report. To use the Report Wizard to create the report.

Comments/Prompts

6-2

Lesson 6: Creating and using reports

5.

Display the Choose The Table Or Query Where The Objects Data Comes From drop-down list and select
tblHumanResourcesData

To base the report on the tblHumanResourcesData table. 6. Click on OK To advance to the next dialog box.

Task A-2: Adding fields to the report


What you do
1. From the Tables/Queries dropdown list, select
Table:tblHumanResourcesData

Comments/Prompts

2.

Verify that strEmpID is selected Click on > To add the strEmpID field to the report.

3.

Add the following fields to the report:


intHours curPayRate strDept memComments

4.

Click on Next>

To advance to the next dialog box.

Grouping data in a report


Concepts > Access provides the option of grouping the report by the entire contents of a field, which means that the final report will divide the table into categories of related records. For instance, if you group the contents of the strDeptCode field, then the employees will be listed by department in the report. You can group up to 10 fields or expressions in a report.

Sorting data in a report


After you have grouped your data, you can further organize it by specifying a sort order. You can sort up to 10 fields or expressions.

6-3

Access 2000: Level 1 (First Edition)

Task A-3: Adding a group and specifying the sort order


q Objective: To organize the data in the report by the strDept field, so that Access displays all of the records for the same department together; to order the data within each department by the curPayRate field.

What you do
1. From the list box, select the strDept field Click on >

Comments/Prompts

To add a grouping level on the Department Code data. When you select a field to be grouped on, Access also sorts by that field. The strDept field is pulled out of the Detail section of the report and placed above it.

2.

Observe the sample report

3. 4.

Click on Next> In the first sort box, display the drop-down list Select curPayRate

To advance to the Sorting dialog box.

To choose curPayRate as the field to sort by (within each department). It will be in ascending order. 5. Click on Next> To advance to the next dialog box.

Report layouts
Concepts > A layout refers to the arrangement of data and labels on a report. You can select one of six layouts.

Report styles
The style defines how the title and the information in the Detail section are displayed on the report.

6-4

Lesson 6: Creating and using reports

Task A-4: Selecting the layout and style of the report


What you do
1. Observe the dialog box

Comments/Prompts
The default layout is Stepped and the Orientation is Portrait. The field width will be adjusted so all fields fit on a page. To accept the default layout of Stepped for the report and advance to the next dialog box.

2. 3.

Click on Next> In the format box, select


Corporate

Click on Next>

To set the style to Corporate and advance to the next dialog box.

Task A-5: Adding a title and previewing the report


What you do
1. Type Hours and Rates by
Department

Comments/Prompts

2. 3.

Click on Finish Observe the Print Preview window

To preview the report.

The report has the title at the top and current date and page number at the bottom. Data is grouped by department code. The records within each department group are sorted by pay rate data. Text fields are left-aligned; number fields are right-aligned.

4. 5.

Explore the toolbar by displaying ScreenTips Move the mouse pointer over the report page The mouse pointer changes to a magnifying glass.
6-5

Access 2000: Level 1 (First Edition)

6. 7. 8.

On the report, click the mouse button On the report, click the mouse button Click on the vertical and horizontal scroll arrows to view the report

To zoom out to single-page view. The Comments field width is adjusted so all fields fit on a page. To return to 100% view. The report lists the employees in pay rate order grouped by the departments in which they work.

Report sections
Concepts > The Report Wizard automatically adds a title, the date, and page numbers to your report. This data is placed in one of the sections of the report. When you view the design of the report, the window might be divided into several areas. These areas control where the information is printed in a report. The following table describes the various report sections:

Section
Report Header Page Header Group Header Detail Group Footer Page Footer

Placement
At the beginning of the report. At the top of each page. At the start of each group. In the body of the report. At the end of each group. At the bottom of each page. At the end of the report.

Commonly used for


Displaying the title and date of the report, or a cover page if the report is long. Making column headings in a tabular report. Indicating how the information in the report is grouped. Displaying information for each record. Displaying summary calculations performed for each group. Adding page numbers to a report. (You can place the expression =Page in this section in an unbound control.) Providing summary calculations for all records in the report.

Report Footer

Task A-6: Viewing the report design


What you do
1. 2. Click on Close If necessary, close the toolbox, field list, and property sheet

Comments/Prompts
To close Print Preview and open the Report Design window. The report Design View window is divided into several sections. The report header contains the title. The strDept Header is for each group. The Detail section contains the fields. The page footer contains a control to provide page numbers and a function to print the current date.

Observe the design of the report


6-6

Lesson 6: Creating and using reports

3. 4.

Observe the controls Close the report Design View window

Labels and fields in the report Design View window are much like those used for form design.

Renaming a database object


Concepts > You can rename a table, query, form, report, page, macro, or module from the Database window. The object must be closed before you rename it. If you rename a table, you need to update any reference to the object in forms and reports in the Record Source property in the property sheet.

Task A-7: Renaming the report


q Objective: To rename the Hours And Rates By Department report object.

What you do
1. Right-click on the report
Hours And Rates By Department

Comments/Prompts

Choose _Rename_ 2. Type rptMyHoursAndRates Press R

To rename the report. The new object name adheres to the Leszynski Naming Convention by using the tag rpt. To complete the renaming.

6-7

Access 2000: Level 1 (First Edition)

b
Concepts >

Creating a report that contains totals


Calculated fields
A report can be based on a table or a query. Basing a report on a query is an easy way to include calculated fields and selected records, or to print data from more than one table. Although you can add a calculated field to a report after it is created, it is much easier to create the calculated field in a query and use the Report Wizard to add the calculated field to the report.

Figure 6-2: The report after Task B-4 is completed.

Task B-1: Creating a report with the Report Wizard


q Objective: To view the query the report will be based on; to create the report by specifying its source, fields, field groups, and sort order.

What you do
1. Open the qryEmployeeInformation query and view the results Change to Design View Close the query Design View window

Comments/Prompts
Thirteen fields are included, the last of which is the calculated field, Gross Pay. The information is from four joined tables. Only selected fields are included. Gross Pay is a calculated field.

6-8

Lesson 6: Creating and using reports

2.

Display the list of report objects Click on the New button To display the New Report dialog box.

3.

Select Report Wizard From the Choose The Table Or Query Where The Objects Data Comes From drop-down list, select the
qryEmployeeInformation

To base the report on a multi-table query.

query 4. 5.

Click on OK Add the following fields to the report:


strFirstName strLastName strDeptName intHours curPayRate Gross Pay

To advance to the next dialog box.

Click on Next> 6. Select strDeptName Click on > Click on Next> 7. Display the first sort level drop-down list Select strLastName Display the second sort level drop-down list Select strFirstName

To advance to the Grouping dialog box. To group the data by the department name.

To advance to the Sorting dialog box.

To produce a primary sort on the employees last names. If there are duplicate last names, they will be secondarily sorted by first names within each department.

Summary information
Concepts > You can perform summary operations on currency, number, and yes/no field types in the report. Using calculations in your report enables you to summarize data. You can calculate summary, average, minimum, and maximum values. These values can be calculated for each group, for every record included in the report, or for both.

6-9

Access 2000: Level 1 (First Edition)

Task B-2: Adding summary fields and choosing a layout


What you do
1. 2. Click on Summary Options... Observe the options

Comments/Prompts
To display the Summary Options dialog box. The main area displays the fields on which you can perform calculations. Only number and currency values can have summary operations performed on them. Three fields in this report qualify: intHours, curPayRate, and GrossPay. There are four different types of summary information: Sum, Avg, Min, and Max.

3. 4.

For the field curPayRate, check the Avg check box Observe the Show box The Average Pay Rate summary information will be displayed as both a subtotal (for each department) and a grand total (for all departments).

5.

For the field Gross Pay, check Sum

Observe the Show box

The Total Pay Rate summary information will be displayed as both a subtotal (for each department) and a grand total (for all departments). To return to the Sorting dialog box. To advance to the Layout dialog box. The layout of the report determines the arrangement and page orientation of information in the report.

6. 7.

Click on OK Click on Next>

8. 9.

In the Layout box, select


Block

Click on Next>

To advance to the Format dialog box.

6 - 10

Lesson 6: Creating and using reports

Task B-3: Finishing and previewing the report


What you do
1. From the list of styles, select
Bold

Comments/Prompts
The sample image displays the effect of the Bold style. To advance to the next dialog box. To give the report a title and preview the report.

Click on Next> 2. Type Employee Pay Summary Click on Finish 3. Observe the report

The information is grouped by the department name. The summary data is displayed for every group. The gross pay summary data does not display dollar signs. A grand total for gross pay is displayed at the end of the report. To close the Print Preview window and view the report design. The Report Wizard built the design as you progressed through the Wizard dialog boxes.

4. 5.

Click on Close Observe the report design

Report properties
Concepts > You can enhance the appearance of a report by modifying the properties of its controls. To do this, select the control, display the property sheet, and change specific property settings. For example, you can use the Format property to customize the way numbers, dates, times, and text are displayed and printed.

6 - 11

Access 2000: Level 1 (First Edition)

Task B-4: Viewing and changing field properties


q Objective: To format the summary value for the Gross Pay field to display dollar signs.

What you do
1. In the strDeptName Footer section, for the =Sum[Gross Pay] text box control, display the property sheet Click in the Format property text box Display the Format dropdown list

Comments/Prompts
(Use the Properties button or the right-click menu shortcut.)

2.

To display the values with a leading dollar sign.

Select Currency 3. Preview the report

The AutoFormat feature


Concepts > You can use the AutoFormat feature to quickly change the appearance of a report.

Task B-5: Changing the appearance of a report


What you do
1. Return to Design View Choose _Edit_ _Select_All_ 2. Click on the AutoFormat button To display the AutoFormat dialog box . 3. From the Report AutoFormats list, select
Casual

Comments/Prompts

(Or press Ctrl + A.)

The sample image of the report updates to display the Casual style.

6 - 12

Lesson 6: Creating and using reports

4.

From the Report AutoFormats list, select


Compact

Click on OK 5. Preview the report Close the preview window 6. Save the report

To return to the report design. The appearance of the report is changed.

Printing reports
Concepts > When you want to print a report, you can print all records, a selection of records, or a specific range of pages. You can also specify the number of copies to print and the page orientation (portrait or landscape). Other printing options include margins and paper size.

Task B-6: Examining the Print dialog box


What you do
1. 2. Choose _File_ _Print..._ Observe the Print dialog box

Comments/Prompts
To display the Print dialog box. The printer is the default Windows printer. The Print Range is All, which prints all the pages of the report. You can select another option to print specific pages if you do not need to print the entire report. To close the Print dialog box without printing. Do not save changes if prompted.

3. 4.

Click on Cancel Close the report Close the database

6 - 13

Access 2000: Level 1 (First Edition)

Practice Unit for Lesson 6


In this activity, you will create a report by using the Report Wizard. 1. 2. Open the database Reptprac. Display the list of report objects. Use the wizard to create a new report based on the tblBookOrders table. Include the Customer, Quantity, Book Title, and Sales Id fields. Group the report by the values in the Sales Id field. Sort within groups by Book Title. Select the Outline 1 layout and the Soft Gray style. Add the title Sales Representative Summary. View the report. View the report Design View window. Close the report. Close the database.

3. 4. 5. 6.

Figure 6-3: The completed Sales Representative Summary report.

6 - 14

Lesson 6: Creating and using reports

Wrap-up for Lesson 6


a Why would you use the Report Wizard?

Why would you base a report on a query?

6 - 15

Creating and maintaining a database

Lesson objectives
To become familiar with database maintenance, you will: a Create a blank database. b Move objects from one database to another.

c Compact a database.

7-1

Access 2000: Level 1 (First Edition)

a
Concepts >

Creating a database
An Access database contains all of the tables, queries, forms, and reports that are related to a particular purpose or topic. There are several ways to create a database. You can create a blank database and then add the database objects later, or you can use the Database Wizard to create the database along with the objects for that type of database.

Creating a blank database


To create a blank database, use the New Database button on the toolbar. Database names must conform to the Windows file naming rules. Access automatically assigns the .MDB file extension to databases.

Using the Database Wizard


The Database Wizard enables you to create a database quickly and efficiently; it provides many ready-to-use databases, complete with tables queries, forms, and reports. You can always customize generic database objects to better suit your needs.

Task A-1: Creating and naming a blank database


q Objective: To create a blank database that will hold objects that have already been created.

What you do
1. Click on the New button

Comments/Prompts

To display the New dialog box. 2. Select the Databases tab Observe the icons Each icon represents a type of database that you can create. Selecting an icon prompts the Database Wizard to create, in one operation, all the tables, forms, reports, and data access pages for the selected type of database.

7-2

Lesson 7: Creating and maintaining a database

3.

Select the General tab

Select the Database icon Click on OK

To create a blank database. To display the File New Database dialog box. This is where you can specify a name and location for the new database. This dialog box, like the Open and Save As dialog boxes, also includes the Places Bar so that you can easily navigate among the places where you might store this database.

4.

In the File Name text box, type MyNewDb Click on Create Access creates the database.

5.

If necessary, maximize the Database window Observe the Database window

The MyNewDb database is open. After you create a blank database, you must perform additional steps to define the objects that will make up the database.

7-3

Access 2000: Level 1 (First Edition)

b
Concepts >

Managing a database and its objects


Working with an entire database
If you want to rename, copy, delete, or move an entire database, you can do so by using Windows Explorer. Windows Explorer enables you to browse and manage resources. You can use the Windows Explorer to view the folders containing your Access databases. Objects are organized in a hierarchical tree-like structure, with the desktop as the highest container object. Access database files have an extension of .MDB. When using Windows Explorer to view the Access databases, you do not see a list of objects that make up the databaseyou see just the database. Therefore, you cannot copy Access objects from one database to another by using the Windows Explorer.

Working with individual database objects


Because Access objects reside in a database file, you must use Access to copy, delete, and rename objects. There are several ways to work with individual objects.

The Database window and the Clipboard


When you work in the Database window, the Clipboard is available so that you can cut or copy objects and paste them in a new location. For instance, with a table selected, you can choose either the Cut or Copy button from the Database toolbar. If you are moving or copying the table to a different database, close the current database and open the database into which you want to paste the object. When you work within the Database window, you can also delete and rename individual database objects.

Importing database objects


The File, Get External Data, Import and the File, Get External Data, Link Tables commands are usually the most efficient way to copy Access objects. You can also use these commands to import or export objects to and from other software applications as well as between Access databases.

Task B-1: Importing an object


q Objective: To copy a table from the Copy database to the MyNewDb database.

What you do
1. In the Database window, ensure that the list of table objects is displayed Choose _File_
_Get_External_Data_ _Import..._

Comments/Prompts

2.

To display the Import dialog box.

7-4

Lesson 7: Creating and maintaining a database

3.

Select the database Copy Click on Import

To display the Import Objects dialog box. 4. Select the table


tblHumanResourcesData

To select the table to import to the MyNewDb database. To import the table. The MyNewDb database now contains the tblHumanResourcesData table.

Click on OK 5. Observe the Database window

Practice Task
Import the tblPersonalData table from the Copy database into the MyNewDb database.

Importing multiple objects


Concepts > Access enables you to import more than one object at a time. Each object must be selected in the Import dialog box.

7-5

Access 2000: Level 1 (First Edition)

Task B-2: Importing more than one object


Before you begin: Complete the Practice Task at the end of Task B-1.

What you do
1. Choose _File_
_Get_External_Data_ _Import..._

Comments/Prompts

Select the database Copy Click on Import 2. Select the tblDepartment table Hold down S Select the tblParkingInfo table Release S Two tables are selected. 3. Select the Queries tab Click on Select All 4. Select the Forms tab Select the frmPhoneData form 5. Select the Reports tab Select the rptParkingLot report 6. 7. 8. Click on OK In the MyNewDb Database window, view the objects Close the Database window To import all the objects. To select the two queries to be imported.

7-6

Lesson 7: Creating and maintaining a database

c
Concepts >

Database maintenance
Once you create and start using your database, you will probably need to perform some maintenance tasks to help protect it and keep it up-to-date.

Backing up a database
A very important administrative task in maintaining a database is creating a backup of the database. Backup copies protect you against losing critical data. Since Access stores all database information in one file, backing up a database is not a complicated procedure. You can use the Windows Explorer, My Computer, the MSDOS Copy command, or backup software to copy the database file (an .MDB file) to the backup medium of your choice.

Converting a database
Because Access has been around for many years, many databases have been created using this program. If you attempt to open a database created in a previous version of Access, you will be prompted to either convert the database or open the database. If you convert the database, Access creates a brand new file from the old version; however, you will not be able to use the database with previous versions of Access. If you opt to open the database instead of converting it, you will still be able to use the database with previous versions of Access but you can only view the database objects; you will be unable to change the design of any objects. Likewise, you can convert a database file to a prior version of Access by using the Tools, Database Utilities, Convert Database command.

Compacting a database
Compacting a database helps it to run more efficiently and take up less storage space. When you delete tables or records, the database can use disk space inefficiently, because hard disk space within the database remains unused. This is called fragmentation. To reclaim the unused hard disk space, you can compact your database. This makes a copy of the database, rearranging how the database file is stored on disk. You can use the same database name or specify a new name.

Repairing a database
In most cases, Access will detect that a database is damaged when you try to open, compact, encrypt, or decrypt it. At that time, it will give you the option to repair the database. However, in some cases, Access might not detect that a database is damaged. If a database behaves unpredictably, you can manually repair the current database by using the Tools, Database Utilities, Compact And Repair command. If you want to specify a new name or location for the database, close the current database and then issue the command.

7-7

Access 2000: Level 1 (First Edition)

Task C-1: Deleting a table and compacting a database


What you do
1. Open the Maint database If necessary, maximize the Database window 2. Select the table 3.
tblHumanResourcesData

Comments/Prompts
You can have only one database open at a time. But within a database, you can have multiple objects open.

Press D Click on Yes

In the alert box, you are asked to confirm that you want to delete the table. As you add and delete objects in a database file, the file can become fragmented and inefficient.

4. 5.

Close the Database window

Choose _Tools_ _Database_Utilities_


_Compact_And_Repair_Database_

Compacting a database eliminates fragmentation and improves performance. 6. Select Maint Click on Compact

To select a database you want to compact. 7. In the File Name text box, type MyMaint Click on Save 8. Click on the Close button To enter a filename for the compacted database. You can specify a new name for the compacted database or use the same name. Access makes a copy of the database. To exit Access 2000.

7-8

Lesson 7: Creating and maintaining a database

Exiting Access
Concepts > When you exit Access by choosing File, Exit or by clicking on the Close button in the application window, Access automatically saves any unsaved changes to data. If you have changed other Access objects, then you will be prompted to save those changes before you exit. You should always use one of these methods to exit Access to ensure that all of your work is saved.

7-9

Access 2000: Level 1 (First Edition)

Wrap-up for Lesson 7


a Why would you create a new database?

Which file extension is automatically assigned to databases in Access?

Why might you want to copy objects from one database to another?

Why would you compact a database?

7 - 10

Data Access Pages

Appendix objective:
To become familiar with Data Access Pages as a means to produce forms and reports for the Web.

A-1

Access 2000: Level 1 (First Edition)

a
Concepts >

Data Access Pages


A Data Access Page is a new Access 2000 object that enables users to publish Access data in a format that you can view and edit with the Web browser, Microsoft Internet Explorer 5.0. A Data Access Page is an HTML (HyperText Markup Language) file that you design in Access and run in the browser. HTML is the formatting language for files on the Internet. You can create a Data Access Page either with the help of a wizard or in Design View. Design View includes familiar tools like a property sheet, a field list, and a toolbox, which includes tools specific to the Web environment. Data Access Pages are stored separately from the database (.mdb file) itself, but the data manipulated through these forms is linked to the actual database. Because of the live linking, Data Access Pages are ideal for sharing information over a corporate intranet, reporting, and for entering data through the browser.

Grouped Data Access Pages


You can create Grouped Data Access Pages that enable users to interact with related data in a manner similar to working with related data files. Grouped Data Access Pages are pages that represent hierarchical data. An example of hierarchical data would be customers and their related orders. Using Grouped Data Access Pages enables the user to view the data from a top-level view and drill down to more detailed data as desired.

A-2

E F E R E N C E

Reference section

Contents
To be able to understand the basic concepts covered in this course, the following reference materials are provided: Solutions Quick Reference Glossary R-2 R- 8 R - 10

R-1

O L U T I O N S

L E S S O N Wrap-up responses
Wrap-up items
a When you start Word, what two toolbars are displayed in the application window? In the application window, how can you determine the name and function of a button on the toolbar? b What are some examples of nonprinting characters? How do you display or hide the nonprinting characters? c How do you save a document with a new name and to a new location? Describe how you remove a document from memory once you have created and saved it. d What command do you use to open an existing document and display a copy of the document in the active document window? What happens to selected text when you begin typing? How do you save a document with the same name and to the same location? e What is the Office Assistant?

Responses
The Standard and Formatting toolbars.

Place the mouse pointer over the button. A ScreenTip displays a descriptive name of the button.

Paragraph marks, space marks, and tab marks. Click on the Show/Hide button. Choose File, Save As. Choose File, Close.

The File, Open command.

It is replaced with the newly typed text. Click on the Save button or choose File, Save.

It is an animated online aid that helps you use Words Help system. Click on the Office Assistant, enter a question or keyword, then click on Search.

How do you use the Office Assistant?

R-2

Solutions

L E S S O N Wrap-up responses
Wrap-up items
a Describe how you can use the scroll bar to view your document.

Responses
Click on the scroll arrows to move the document one line at a time. Click in the scroll bar above or below the scroll box to move approximately one screen at a time. Drag the scroll box to move the document to a specific location.

By using the keyboard, how can Press Ctrl + Home. you move the insertion point to the top of the document? What command can you use to move to a specific page? Why would you use the Edit, Replace command in your work environment? How do you use the Select Browse Object button? Edit, Go To. Answers might include: if you spelled a name wrong, or a new vendor has replaced an old vendor mentioned in a document. Click on the Select Browse Object button and select a browse option. Then, use the double arrows to navigate through the browse option you selected.

L E S S O N Wrap-up responses
Wrap-up items
Describe editing techniques you have used with typewritten documents. a What Word feature will automatically fix certain mistyped words? How do you create a new document?

Responses
Answers might include: using correction fluid, starting over with a new piece of paper, cutting and pasting, and photocopying. The AutoCorrect feature.

Click on the New button, or choose File, New.

R-3

Word 2000: Level 1 (First Edition)

Describe how you can use the selection bar to select a line, a paragraph, or the whole document.

To select a line, place the mouse pointer in the selection bar, point to the line, and click the mouse button. To select a paragraph, point to the paragraph in the selection bar and double-click the mouse button. To select the whole document, point anywhere in the selection bar, press Ctrl, and click the mouse button. The Shift key.

When you select text with the mouse, what key can you use to extend or reduce a selection? c What is the Clipboards role in copying and moving text? How do you move text from one point to another?

The Clipboard is a temporary storage area for cut or copied text or graphics. Select the text; click on the Cut button; move the insertion point to the new destination; and then click on the Paste button. Or, select the text; press and hold the mouse button over the selection; drag to the new destination; and then release the mouse button.

L E S S O N Wrap-up responses
Wrap-up items
a Why would you apply formatting to a document?

Responses
To make a document more visually appealing, and to draw the readers attention to certain sections of a document. Select the text.

What is the first step necessary to apply character formatting to text? b How can you repeat a character format? How can you copy the formatting of text to unformatted text?

By pressing either F4 or Ctrl + Y, or by choosing Edit, Repeat from the menu. By using the Format Painter button or pressing Ctrl + Shift + C to copy the formatting and pressing Ctrl + Shift + V to paste, or apply, the formatting. Anywhere in the paragraph you want to affect.

Where must the insertion point be located before you change paragraph formatting?

R-4

Solutions

What does the term indent mean? How can you create a numbered or bulleted list?

The difference between text boundaries and page margins. Select the text, and click on either the Numbering or Bullets button. Press Shift + Enter. Press Shift + Ctrl + Spacebar.

How do you add a line break character? How do you add a nonbreaking space?

L E S S O N Wrap-up responses
Wrap-up items
a List the steps necessary to set a left tab stop at 2 inches by using the ruler. How can you delete a tab stop from the ruler? Give some examples of when you might want to use a dot leader tab. b What type of information can you put into a table? Define the term cell. c What effect does pressing Tab have on the table when the insertion point is located in the last cell in a table? How can you insert a column into the middle of a table?

Responses
1. 2. 3. Select the appropriate paragraph or paragraphs. Select the Left Tab alignment button. Click on the 2-inch mark on the ruler.

Point to the tab stop and drag it off the ruler. Answers might include: telephone directories, menus, and tables of contents. Data, side-by-side paragraphs, and columns of information. The intersection of a column and a row in a table. A new row is created.

Select a column and click on the Insert Columns button (or choose Table, Insert, Columns To The Left or Columns To The Right).

R-5

Word 2000: Level 1 (First Edition)

L E S S O N Wrap-up responses
Wrap-up items
a Describe how you can switch between the header and the footer when you are creating or editing the headers and footers. How can you add automatic page numbering to a footer? b What command can you use to change a documents margins? What is Zoom used for? c What is the difference between an automatic and a manual page break?

Responses
Click on the Switch Between Header And Footer button on the Header And Footer toolbar.

Click on the Insert Page Number button on the Header And Footer toolbar. The File, Page Setup command. To change the magnification level of a document. An automatic page break is generated by Word based upon a documents page settings. A manual page break is intentionally inserted (by you) and is displayed as a dotted line with the words Page Break in the middle. Select it and press Delete. You can only remove an automatic page break by placing a manual page break before it.

How can you delete a manual page break? Can you delete an automatic page break?

L E S S O N Wrap-up responses
Wrap-up items
a What office tools or books can some of Words tools supplement? Describe how you can correct a word that has been underlined in red as a result of the Automatic Spell Check feature. b Why would you want to edit a document in Print Preview?

Responses
Answers might include a dictionary, thesaurus, and eraser. Delete and type the word correctly. Or, place the insertion point in the underlined word; click the right mouse button; and select the correct spelling. To make last-minute changes to the document before printing.

R-6

Solutions

How can you use Word to create an envelope for a letter? How might you use labels after you have created them?

Choose Tools, Envelopes And Labels; select the Envelopes tab; enter the mailing and return addresses; and click on Print. Answers might include: for a mailing, for a return address, to put inside books, or for videotapes.

L E S S O N Wrap-up responses
Wrap-up items
a Describe how to convert an existing document into a Web page. Which view simulates how your Web page will be displayed by a browser? What is a Web browser?

Responses
Click on File, Save As Web Page.

Web Layout View.

A browser is an application that enables you to view Web pages. A Theme is a collection of complementary color schemes, font choices, and other design elements. A Theme provides your documents and Web pages with a consistent and professional look.

What is a Theme?

What is the benefit of using a Theme?

R-7

U I C K

R E F E R E N C E For Access 2000

Database window
Function
Creating a database Creating a new table

Menu choice
File, New

Keystrokes C+N
Display the list of table objects; click on New; select Design View Display the list of table objects; click on New; select Table Wizard

Toolbar

Creating a new table by using the Table Wizard Importing objects Opening a database Opening a form File, Get External Data, Import File, Open

C+O
Display the list of Form objects; select the form you want; click on Open Display the list of Table objects; select the table you want; click on Open Display the list of Report objects; select the Report you want; click on Preview Display the list of Query objects; select the query you want; click on Open

Opening a table

Previewing a report

Running a query

R - 14

Quick reference

Datasheet window
Function
Adding records

Menu choice

Keystrokes
Move to the blank record at the end of the datasheet; enter the data

Toolbar

Checking the spelling Copying values Deleting fields Examining the table design Filtering records by selecting a value Finding a record Inserting fields Moving fields

Tools, Spelling Edit, Copy Edit, Delete Column View, Design View Records, Filter, Filter By Selection Edit, Find Insert, Column

7 C+C

C+F

Select the field you want to move; drag it to the new location Edit, Paste

Pasting values Renaming fields

C+V
In Table Design view, select the field you want to rename; type the new field name; or in Datasheet view, place the insertion point in the field you want to rename and choose Format, Rename Column

Saving changes to the design Sorting records in ascending order Sorting records in descending order Setting a primary key Undoing changes

File, Save As Records, Sort, Ascending Records, Sort, Descending Edit, Primary Key Edit, Undo (Choices may vary)

C+Z

R - 15

Access 2000: Level 1 (First Edition)

Queries
Function
Adding fields to a query

Menu choice

Keystrokes
In the field list, select the field you want; drag it to the design grid

Toolbar

Adding a table to the query Creating a calculated field

Query, Show Table Move to an empty column in the design grid. Enter the expression in the field cell. If field names are included in the expression, they must be enclosed in square brackets. In the upper pane of Query Design View, drag a field from one table to a matching field in the second table. View, Totals Click on the criteria cell for the field you want; input the criteria you want

Joining two tables

Perform vertical calculations on a field Using criteria

R - 16

Quick reference

Forms
Function
Adding records

Menu choice

Keystrokes
Move to the blank record at the end of the form; enter the field values

Toolbar

Finding a record Moving controls

Edit, Find

C+F
Select the control you want to move. Place the mouse pointer on the large square in the upper-left corner. Drag the control to the new location. Select the control and label you want to move. Place the mouse pointer on the bottom edge of the field control. Drag the control and label to the new location.

Moving controls and labels

Sorting records

Records, Sort, Ascending Records, Sort, Descending

Undoing changes Viewing properties for controls

Edit, Undo (Choices may vary) View, Properties

C+Z

Reports
Function
Changing the format of the report Enlarging and restoring the report Sorting and grouping records

Menu choice

Keystrokes

Toolbar

R - 17

L O S S A R Y

AND condition Used in queries to specify that two or more criteria must be true for the records to be included in the result. ascending order A sort order that groups data from 0 to 9 and from A to Z. bound controls On a form or report, these contain the fields from the table. calculated fields An expression in a design grid field cell that performs a calculation on one or more fields in the table. compact A technique used to reclaim unused harddisk space. comparison operators Used to limit selections to specific ranges of values. controls Graphical objects you can place inside a form or report. Text boxes and labels are common types of controls. Each kind of control has a slightly different set of properties. criteria In the Query Design window, a test that the records in the table must meet to be included in the result. data type Determines what kind of data can be entered and what kinds of operations Access can perform on the data. data type The categories of data characteristics, including Text, Numeric, Currency, Date/Time, and Memo. database A collection of data related to a particular topic or purpose, and the tools for using the data. Database window The window that contains and lists the Access objects that together make up the Access database-management system. datasheet A tabular view of your data in which each column is a field and each row is a record. descending order A sort order that groups data from Z to A and from 9 to 0.

design grid The lower pane of the Query Design window. design view The environment where you define what an object should store. Detail section In a report, this section contains the fields that you want Access to print for every record. expression Any combination of functions, field names, numbers, text, and operators that calculates a result. Used to create calculated fields. field A column in a table that contains a category of information. field properties Enable you to customize how a fields data is stored, handled, or displayed. filter A technique that enables you to view and work with a subset of your data. After defining the criteria and filtering the records, Access displays only the records that meet the criteria. form An Access object that enables you to view and use the information that is stored in a table in a format other than columns and rows. Form Wizard An Access feature that walks you step-by-step through the creation of a form. group footer In a report, Access prints the information in this section at the end of each group. group header In a report, Access prints the information in this section at the start of each group. index Used by Access to quickly find and sort records. label A control that displays text. multiple-field primary key Used in situations when one field is not unique, but two fields together contain unique values.

Source: Access 2000 online Help system R - 18

Glossary

multiple-table form A form that displays the related data from two or more tables simultaneously. multiple-table query A query in which two or more tables are joined to display one or more fields from each table in the query results. naming conventions A set of rules for naming database objects; naming conventions enable you to review and troubleshoot a database design without decoding your work. Navigation buttons A series of four buttons in the lower left of the Datasheet and Form windows that you can use to make a record current. objects The Access components that make up a database. Objects include tables, forms, queries, and reports. one-to-many relationship The type of relationship that exists when one of each data value exists in the common field of the first table and matches more than one of the values in the second table. one-to-one relationship The type of relationship you have when one of each data value exists in the common field of the first table and matches one of these values in the second table. OR criteria Used in queries to specify that of two or more criteria, at least one condition must be true for the records to be included in the result. page footer In a report, Access prints the information in this section at the bottom of every page. page header In a report, Access prints the information in this section at the top of each page of the report. primary key A field, or combination of fields, that uniquely identifies each record in a table. query An Access object for storing questions that you ask about information in a table. record A row in a table that contains all of the information about one person, thing, or event. relational database-management system Enables you to view the information from multiple tables at the same time by relating the tables to one another. relationship A join between two tables, based on a common field.

report An Access object for storing the design of a printed report. report footer In a report, Access prints the information in this section at the end of the report. report group A collection of related records. report header In a report, Access prints the information in this section at the beginning of the report. ScreenTips The short description of the toolbar button that is displayed after a few seconds when you position the mouse pointer over the button. select query A query that selects a subset of records from a table. The records selected are determined by the criteria entered in the query. sort The process by which Access rearranges information; for instance, in alphabetical or numeric order or by categories of information, such as by state or zip code. table A collection of related information that is stored in rows and columns. toolbox A collection of command buttons designated as tools. Available in Form and Report Design Views. unbound controls On a form or report, these contain the label of each field, or they contain other text, such as the report or form title. wildcards Part of the criteria used to select a group of records. Wizards Features that lead you step-by-step through various Access tasks, such as creating tables, forms, queries, and reports.

R - 19

I
A
adaptive menus, 1-13 AND condition, 4-13 AutoFormat feature, 6-12 AutoNumber field, 2-10 planning, 1-19 window, 1-15 Datasheet View, 2-2, 4-6, 4-7, 4-8, 4-17, 5-7 Design View, 2-5, 2-13, 4-3, 4-23, 5-7

N D E X

E
Edit menu Delete command, 3-14, 4-24 Find command, 5-15 Undo Typing command, 3-11 environment, 1-12 expression, 4-19 extracting, 1-2

C
calculated field, 4-19 captions, 2-14 commands, 1-13 Edit, Delete, 3-14, 4-24 Edit, Find, 5-15 Edit, Undo Typing, 3-11 File, Exit, 7-9 File, Save As, 4-8 Records, Save Record, 3-2 Tools, Database Utilities, Compact And Repair, 7-7 common field, 1-22 comparison operators, 5-16 conditions, 4-13 controls, 5-7 properties, 5-10 resizing, 5-10 types, 5-8 criteria, 4-7 expressions, 4-12 filtering, 5-16 multiple, 4-13 operators, 4-11

F
fields, 1-4 adding, 4-10 AutoNumber, 2-10 calculated, 4-19, 6-8 common, 1-22 comparison operators, 4-12 copying, 3-16 descriptions, 2-5 descriptions, adding, 2-17 designing, 1-20 grouping, 6-3 names, 2-6, 2-14 null values, 4-16 properties, 2-7, 3-8 queries, 4-4 resizing, 5-10 searching, 3-11 select queries, 4-2 sizes, 2-14 undoing changes, 3-11 File menu Exit command, 7-9 Save As command, 4-8 filters, 3-17, 5-16 Find feature, 3-10 Form View, 5-7 Form Wizard, 5-2, 5-10 formats, selecting, 2-16 forms, 5-2 controls, 5-7 controls properties, 5-10 design modification, 5-7 finding records, 5-15 layouts, 5-3 multiple, 5-18 multiple-table queries, 5-18 name, 5-4 navigating, 5-5

D
data deleting values, 3-14 forms, 5-6 moving/copying, 3-16 saving, 3-2 selecting, 3-14 summarized, 4-21 types, 2-6 values, 1-4 Data Access Pages, A-2 Database Wizard, 7-2 databases, 1-2, 1-4, 7-4 backing up, 7-7 compacting, 7-7 converting, 7-7 creating, 7-2 design, 1-20 importing objects, 7-4 maintenance, 7-7 multiple objects, importing, 7-5

I-1

Access 2000: Level 1 (First Edition)

objects, 1-6 preview, 5-13 renaming, 6-7 styles, 5-4 titles, 5-12 types of controls, 5-8 fragmentation, 7-7

I-2

Index

I
index, 2-21

L
layouts forms, 5-3 report, 6-4 Leszynski Naming Conventions (LNC), 1-16, 2-6

renaming, 6-7 results, 4-6 saving, 4-8 select, 4-2 sorting records, 4-6 summarized data, 4-21 temporary datasheet, 4-6

R
records, 1-4 adding, 3-2, 3-15 criteria, 4-7 deleting, 3-14 filtering, 3-17, 5-16 finding, 3-9 forms, 5-15 null values, 4-16 selecting, 3-14 sorting, 3-17, 4-6, 5-16 undoing changes, 3-12 Records menu, Save Record command, 3-2 relational database-management system, 1-2 relationships, 1-22 one-to-many, 1-23 one-to-one, 1-22 Report Wizard, 6-2 reports, 6-2 calculated fields, 6-8 grouping, 6-3 layouts, 6-4 objects, 1-6 printing, 6-13 properties, 6-11 renaming, 6-7 sections, 6-6 sorting, 6-3 styles, 6-4

M
menu bar, 1-12 multiple-table query, 5-18

N
naming conventions, 1-16 navigation buttons, 2-3 null values, 4-16

O
objects, 1-6, 1-17, 7-4 Data Access Pages, A-2 renaming, 6-7 Office Assistant, 1-8 one-to-many relationship, 1-23 one-to-one relationships, 1-22 operators, 4-11 comparison, 4-12 logic, 4-13 OR condition, 4-14

P
pages, objects, 1-6 primary key, 2-5, 2-7, 2-10, 4-16 multiple fields, 2-21 setting, 2-18 types, 2-21

S
scroll bars, 2-3 sections, report, 6-6 select queries, 4-2 sorting, 1-2, 3-17 multiple field, 3-18 spelling check feature, 3-12 status bar, 1-13 styles, 5-4, 6-4 summarizing, 1-2 summary operations, 6-9

Q
queries calculations, 4-18 creating, 4-3 editing, 4-17 fields, selecting, 4-4 joining tables, 4-23 multiple-table, 5-18 null values, 4-16 objects, 1-6 operators, 4-11 printing, 4-6 refining results, 4-10 removing joins, 4-24

T
Table Wizard, 2-9, 2-13 tables, 1-4 Design View, 2-5, 2-13 design, modifying, 3-5 designing, 1-20 joining, 4-23 joining, automatic, 4-23

I-3

Access 2000: Level 1 (First Edition)

joining, manually, 4-24 modifying, 2-11 objects, 1-6 renaming, 6-7 tag, 1-16 temporary datasheet, 4-6 toolbars, 1-13 toolbox, 5-12 Tools menu, Database Utilities, Compact And Repair command, 7-7

I-4

Index

V
views Datasheet, 4-6, 4-7, 4-8, 4-17, 5-7 Design, 4-3, 4-23, 5-7 Form, 5-5, 5-7

W
wildcards, 4-11 wizards Database, 7-2 Form, 5-2, 5-10 Report, 6-2

I-5

Você também pode gostar