Escolar Documentos
Profissional Documentos
Cultura Documentos
Student Manual
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
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
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
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
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
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
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
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
Reference section
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.
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
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
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
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
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.
1-1
a
Concepts >
Comments/Prompts
________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________
2.
3.
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
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.
1-3
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.
1-4
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
b
whats new
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
Source data
tables
queries
data resulting from questions you ask of a table
reports
printed output (might contain group summary information)
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
________________________________________
1-7
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.
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.
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
Figure 1-3: The Open dialog box with the contents of the Student folder displayed.
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.
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
4.
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.
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
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.
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
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.
1 - 11
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.
Object bar
Status bar
Figure 1-4: The Access screen with the Database window displayed.
1 - 12
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.
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
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.
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
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
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
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
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
3.
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 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
1 - 17
c
Concepts >
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?
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.
1 - 18
4.
5.
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
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
Parkin g Lot
MA MA BL WI
Park Fee
13.25 13.25 12.00 10.75
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
1 - 21
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
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
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.
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.
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
Identify the Access 2000 term that goes with each of the following definitions: A single set of related data values:
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.
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
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.
Comments/Prompts
The contents of the Student folder are listed. Table names are listed alphabetically.
Choose _Open_
2-2
3.
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.
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.
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.
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
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.
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.
2-4
Comments/Prompts
2-5
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
Select this
Text Number Currency Date/Time Yes/No Memo AutoNumber OLE object
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
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.
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.
7.
8. 9.
2-8
b
Concepts >
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
6.
From the Sample Fields list, select EmployeeID Click on > To add EmployeeID to the Fields In My New Table list.
7.
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.
4. 5.
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.
Comments/Prompts
You have entered all the information necessary to create a table.
3. 4.
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
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
c
whats new
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
Figure 2-3: The paper data form that contains Human Resources data.
2 - 13
Comments/Prompts
2.
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).
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.
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.
2 - 14
6.
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
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
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.
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
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
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.
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.
2 - 18
Option
Yes
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.
3.
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
8.
9.
The field headings correspond to the captions you created in Design View. The Hours and Pay Rate fields display zeros.
2 - 20
d
Concepts >
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.
Comments/Prompts
2 - 21
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
Records are sorted primarily by Employee ID and secondarily by Project Code numbers.
2 - 22
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.
2 - 23
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?
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
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
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
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.
Comments/Prompts
3.
3-2
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
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.
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.
3-4
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
b
Concepts >
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.
Comments/Prompts
2.
5.
3-6
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
Practice Task
1. 2. Change the field name dtmHd to dtmHired . Change the caption to Hired .
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
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
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
3-8
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
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
c
Concepts >
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.
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
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
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.
What you do
1. Click on the Undo button
Comments/Prompts
The last edit (Zee) returns to the original value (Gardner). 2. Press R
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.
There is a triangle icon by the record for Daniel Gordon. The record for Anne Gordon is current.
3 - 12
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.
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.
3 - 13
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.
4. 5.
The word celebrating was misspelled and the correct spelling is selected.
3 - 14
d
Concepts >
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.
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.
5.
6. 7.
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.
Comments/Prompts
3 - 16
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.
Comments/Prompts
The current field is City. The previous record has the value Hackensack in the City field.
3 - 17
e
Concepts >
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
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_
3 - 19
What you do
1. 2. Choose _Records_ _Filter_
_Advanced_Filter/Sort..._
Comments/Prompts
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
5.
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.
9.
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.
11. Close the table If prompted, save changes to the table Close the database
3 - 20
3 - 21
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
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.
3 - 22
What shortcut key combination do you use to copy values from the previous record?
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
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.
4-1
a
Concepts >
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.
4.
4-2
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.
Who are the employees in the RS department and what are they paid?
Query design
RUN
Query results
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
3.
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.
4-4
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
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.
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
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.
4-7
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
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.
What you do
1. Click on the Save button
Comments/Prompts
To display the Save As dialog box.
2.
4-8
3. 4.
4-9
b
Concepts >
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.
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.
4 - 10
8.
To display the Save As dialog box and rename the changed query.
9.
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
4.
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
What you do
1. 2. Open the qryPayRates query Change to Design View
Comments/Prompts
There are 25 records.
4 - 12
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.
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.
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
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.
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
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
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
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
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
c
Concepts >
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
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.
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
4 - 19
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
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
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
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
What you do
1. Change to Design View Click on the Totals button
Comments/Prompts
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.
Access calculates the total gross pay for each department. 6. 7. Save the query as
qryMyTotals
4 - 22
d
Concepts >
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
________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________ ________________________________________
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.
4 - 23
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.
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
4. 5. 6.
The results include the full department name. This data is drawn from the third table.
4 - 25
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.
4 - 26
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?
When would Access automatically display a join line between two tables in a query?
4 - 27
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
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.
What you do
1. Open the Forms database If necessary, maximize the Database window 2. Display the list of form objects
Comments/Prompts
5-2
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.
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
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.
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
5-4
5-5
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.
Comments/Prompts
5-6
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
b
Concepts >
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.
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.
5-8
3.
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.
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
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
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
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.
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.
To align the bottom edge of the selected controls relative to each other. The selected controls align to the bottom-most control.
5 - 11
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
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.
5 - 12
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.
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.
5 - 13
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
6.
On the Formatting toolbar, display the Font Size dropdown list Select 18
7.
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
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.
5 - 15
c
Concepts >
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.
Barbara Zumbos record is displayed. To close the Find And Replace dialog box.
5 - 16
Sorting records
Concepts > You can sort records in a form to display them in a different order than that of the underlying table.
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.
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
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
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.
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.
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
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.
5 - 20
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
5 - 21
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.
5 - 22
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?
5 - 23
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
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.
Comments/Prompts
6-2
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.
Comments/Prompts
2.
Verify that strEmpID is selected Click on > To add the strEmpID field to the report.
3.
4.
Click on Next>
6-3
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.
3. 4.
Click on Next> In the first sort box, display the drop-down list Select curPayRate
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
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>
To set the style to Corporate and advance to the next dialog box.
Comments/Prompts
2. 3.
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
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.
Report Footer
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.
3. 4.
Labels and fields in the report Design View window are much like those used for form design.
What you do
1. Right-click on the report
Hours And Rates By Department
Comments/Prompts
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
b
Concepts >
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
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
query 4. 5.
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 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
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.
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.
8. 9.
Click on Next>
6 - 10
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.
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
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.
Comments/Prompts
The sample image of the report updates to display the Casual style.
6 - 12
4.
Click on OK 5. Preview the report Close the preview window 6. Save the report
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.
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.
6 - 13
3. 4. 5. 6.
6 - 14
6 - 15
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
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.
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
3.
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.
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
b
Concepts >
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.
7-4
3.
To select the table to import to the MyNewDb database. To import the table. The MyNewDb database now contains the tblHumanResourcesData table.
Practice Task
Import the tblPersonalData table from the Copy database into the MyNewDb database.
7-5
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
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
Comments/Prompts
You can have only one database open at a time. But within a database, you can have multiple objects open.
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.
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
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
Why might you want to copy objects from one database to another?
7 - 10
Appendix objective:
To become familiar with Data Access Pages as a means to produce forms and reports for the Web.
A-1
a
Concepts >
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.
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.
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.
R-3
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
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.
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?
R-7
U I C K
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
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
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
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
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
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.
Sorting records
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.
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
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
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