421 PART IV Exchange Data with Others CHAPTER 18 Exchange Database Objects and Text.. 453 Save an Access Table or Query as a Mail Merge Data Source.. The Microsoft Office Access 2003 dat
Trang 22003
Trang 3This page intentionally left blank
Trang 52100 Powell Street, 10th Floor
Emeryville, California 94608
U.S.A.
To arrange bulk purchase discounts for sales promotions, premiums, or fund-raisers, please
contact McGraw-Hill/Osborne at the above address For information on translations or book
distributors outside the U.S.A., please see the International Contact Information page
immediately following the index of this book
How to Do Everything with Microsoft®Office Access 2003
Copyright © 2003 by The McGraw-Hill Companies All rights reserved Printed in the United
States of America Except as permitted under the Copyright Act of 1976, no part of this
publication may be reproduced or distributed in any form or by any means, or stored in a
database or retrieval system, without the prior written permission of publisher, with the exceptionthat the program listings may be entered, stored, and executed in a computer system, but they
may not be reproduced for publication
1234567890 FGR FGR 019876543
ISBN 0-07-222938-1
Publisher: Brandon A Nordin
Associate Publisher
& Editor-in-Chief: Scott Rogers
Acquisitions Editor: Megg Morin
Senior Project Editor: Jody McKenzie
Acquisitions Coordinators: Tana Allen, Athena Honore
Technical Editor: Margaret Levine Young
Copy Editor: Andy Saff
Proofreader: Stefany Otis
Indexer: Valerie Perry
Computer Designers: Tara A Davis, Lucie Erickson, Jim Kussow, Dick Schwartz
Illustrators: Kathleen Fay Edwards, Melinda Moore Lytle, Lyssa Wald
Series Design: Mickey Galicia
Cover Series Design: Dodie Shoemaker
Cover Illustration: Eliot Bergman
This book was composed with Corel VENTURA™
Publisher
Information has been obtained by McGraw-Hill/Osborne from sources believed to be reliable However, because of the possibility of
human or mechanical error by our sources, McGraw-Hill/Osborne, or others, McGraw-Hill/Osborne does not guarantee the accuracy,
adequacy, or completeness of any information and is not responsible for any errors or omissions or the results obtained from the use of
such information.
Trang 6About the Author
When Grace Hopper, the originator of the concept of program compilers, told Virginia Andersen
in 1948 that there was a future for women in digital computers, she responded, “In what?”
Nevertheless, after graduating from Stanford University, Virginia pursued the idea and carved
out a career applying computers to many challenging projects such as mapping the moon’s
surface in preparation for the Apollo landing; managing large industrial construction projects;
conducting undersea surveillance; simulating navy weapon systems; and building reliability
mathematical models She also found time to teach computer science, mathematics, and system
analysis at the graduate and undergraduate levels at several Southern California universities
Since retiring from the defense industry, Virginia has written or contributed to more than 30books about personal computer–based applications, including database management, word
processing, and spreadsheet analysis She has recently completed the story of her varied uses for
computers over the last 50 years, Digital Recall: Computers Aren’t the Only Ones with Memory
Trang 7This page intentionally left blank
Trang 8Contents at a Glance
1 Get Acquainted with Access 2003 3
2 Create a Database 25
3 Create and Modify Tables 41
4 Relate Tables 73
5 Enter and Edit Data 89
Part II Retrieve and Present Information 6 Sort, Filter, and Print Records 123
7 Extract Information with Queries 139
8 Create Advanced Queries 173
9 Understand Form and Report Design Basics 189
10 Create Custom Forms and Subforms 217
11 Create and Customize Reports and Subreports 255
12 Create Charts and Graphs 295
Part III Improve the Access 2003 Workplace 13 Customize the Workplace 319
14 Speed Up Your Database 341
15 Automate with Macros 357
16 Customize Menus and Toolbars 377
17 Create Custom Switchboards and Dialog Boxes 399
Trang 9Part IV Exchange Data with Others
18 Exchange Database Objects and Text 425
19 Exchange Data with Outside Sources 447
20 Share with Multiple Users 465
21 Secure a Database 477
Appendix Convert to Access 2003 501
Index 509
Trang 10Acknowledgments xix
Introduction xxi
PART I Get Started CHAPTER 1 Get Acquainted with Access 2003 3
Start Access and Open a Database 4
Take a Tour of the Access Window 5
Open a Database 6
Open the Sample Database 9
Tour the Database Window 11
Look at Menu Options and Toolbar Buttons 12
Use Shortcut Menus 13
Open a Table 14
Take a Tour of the Datasheet View 15
Check Out the Subdatasheet 17
Get Help When You Need It 18
Ask a Question 19
Use the Microsoft Access Help Task Pane 21
Ask the Office Assistant 23
Ask What’s This? 23
Get Help with What You’re Doing 23
CHAPTER 2 Create a Database 25
Design an Efficient Database 26
Determine the Goals of the Database 28
Distribute the Data Among the Tables 28
Identify the Data Fields 29
Specify Key Fields 30
Define Table Relationships 31
Complete the Database 32
Create a Database with the Database Wizard 33
Preview the Database Templates 33
Work with the Wizard 34
Trang 11Run the New Application 38
Start with a Blank Database 39
CHAPTER 3 Create and Modify Tables 41
Create a Table with the Table Wizard 42
Choose a Table and Add Fields 42
Set the Primary Key 44
Relate to Existing Tables 45
Create a Table from Scratch in Design View 47
Tour the Table Design View 47
Add Fields 48
Choose a Primary Key 57
Create Other Indexes 58
Create a Table in Datasheet View 60
Save the Table Design 61
Modify the Table Design 62
Switch Table Views 62
Add or Delete Fields 62
Change the Field Order 63
Change a Field Name or Type 63
Change a Field Size 64
Modify or Delete the Primary Key 65
Ensure Data Validity 65
Define Field Validation Rules 66
Define a Record Validation Rule 67
Require an Entry and Prevent Duplicates 69
Handle Blank Fields 69
Assign a Default Value 70
Copy an Existing Table Structure 70
CHAPTER 4 Relate Tables 73
Define a Relationship 74
Use Ready-Made Relationships 74
Use the Relationships Window 75
View and Edit Relationships 85
Modify or Delete a Relationship 85
Change a Table Design from the Relationships Window 86
Print the Relationships 86
CHAPTER 5 Enter and Edit Data 89
Enter New Data 90
Copy and Move Data 90
Insert Pictures 93
Insert Hyperlinks 96
Trang 12Customize Data Entry 99
Add Custom Input Masks 99
Create Lookup Fields 103
Change the Datasheet Appearance 106
Move and Resize Columns and Rows 106
Freeze and Hide Columns 108
Change the Font 109
Change Grid Lines and Cell Appearance 110
Set Datasheet Default Options 111
Change Table Definition in Datasheet View 112
Insert/Delete a Subdatasheet 112
Insert/Delete a Column 113
Change Field Names 113
Edit Record Data 113
Locate Records 114
Find and Replace Data 118
Delete Data 118
PART II Retrieve and Present Information CHAPTER 6 Sort, Filter, and Print Records 123
Sort Records 124
Sort on a Single Field 124
Sort by Two or More Fields 125
Save the Sort Order 125
Filter Records 125
Filter By Selection 126
Use an Exclusion Filter 128
Filter By Form 128
Filter For 133
Filter with Advanced Filter/Sort 133
Save a Filter 135
Remove and Delete Filters 136
Preview and Print Sorted or Filtered Table Data 136
CHAPTER 7 Extract Information with Queries 139
Create a Select Query 141
Use the Simple Query Wizard 142
Tour the Query Design Window 143
Without the Wizard 145
Relate Multiple Tables in a Query 146
Add/Remove Fields 148
Run and Save the Query 149
Hide and Show Fields 150
Trang 13Specify the Record Order 151
Show Highest or Lowest Values 152
Add Selection Criteria 153
Use Wildcards and Operators 153
Use a Single Criterion 154
Use Multiple Criteria 154
Get Help from the Expression Builder 156
Set Query Properties 158
Modify a Query 159
Insert a Field and Change the Field Order 159
Change Field Properties 160
Perform Calculations in a Query 161
Add a Calculated Field 161
Summarize with the Wizard 163
Summarize in the Query Design 164
Create Special Queries with the Query Wizard 166
Create a Find Duplicates Query 166
Create a Find Unmatched Query 167
Create a Crosstab Query 169
CHAPTER 8 Create Advanced Queries 173
Create Special Purpose Queries 174
Parameter Queries 174
AutoLookup Queries 177
Update Query 178
Append Query 181
Delete Query 182
Make-Table Query 183
Look at Structured Query Language (SQL) 185
Review SQL Statements 185
Create a Subquery 187
Define a Criterion 187
Define a New Field 188
CHAPTER 9 Understand Form and Report Design Basics 189
Use AutoForm and AutoReport Features 190
Common Form and Report Design Elements 191
Understand Controls 192
Work in the Design Window 193
Start a New Design 193
Tour the Design Window 194
Add Controls 197
Modify Controls 202
Select Controls and Other Objects 202
Move and Resize Controls 204
Trang 14Align and Space Controls 206
Use Property Sheets 206
Use the Formatting Toolbar 209
Format Conditionally 209
Change a Control Type 212
Delete Controls 212
Modify Form or Report Properties 213
Change the Record Source 213
Apply Filters and Sort Orders 214
Use AutoFormat 214
Add a Background Picture 215
CHAPTER 10 Create Custom Forms and Subforms 217
Create a New Form Design 218
Use the Form Wizard 220
Create a Form Without the Wizard 221
Modify the Form Design 222
Add Form Header and Footer Sections 223
Place and Customize Data-Related Controls 223
Add Yes/No Controls 231
Add User-Interactive Controls 234
Use the Form for Data Entry 237
Size the Form 238
Navigate in the Form 238
Change the Tab Order 238
Locate Records 239
Sort and Filter Data in a Form 239
View Multiple Records 240
Create a Multiple-Page Form 241
Add a Page Break 242
Add a Tab Control 242
Customize a Tab Control 244
Add Special Controls 245
Add Calculated Controls 245
Add an AutoDial Control 245
Create a Hierarchical Form 246
Use the Form Wizard 246
Use the Subform Wizard 248
Use the Hierarchical Form 251
Modify a Subform 251
Add Custom User Guidance 252
Add Data Validation 252
Validate with Properties 253
Validate with Events 253
Trang 15CHAPTER 11 Create and Customize Reports and Subreports 255
Start a New Report 256
Use the Report Wizard 257
Preview and Print the Report 262
Work in the Print Preview Window 262
Use the Layout Preview 264
Print the Report 264
Modify the Report Design 266
Examine the Report Sections 266
Set Report and Section Properties 267
Change the Report Style 268
Add Page Numbers and Date/Time Controls 268
Save the Report Design 270
Sort and Group Records in a Report 270
Change the Sort Order 271
Add Group Sections 271
Customize Group Headers and Footers 273
Add Summaries and Running Totals 274
Apply the Finishing Touches 275
Modify and Add Groups 275
Create a Summary Report with the Report Wizard 278
Print an Alphabetic Index 280
Add a Subreport 281
Create a Subreport with the Report Wizard 282
Create a Subreport Control 283
Insert an Existing Subreport 286
Link the Report and Subreport 287
Modify a Subreport Control 288
Design a Multiple-Column Report 289
Print Mailing Labels 290
Use the Label Wizard 291
CHAPTER 12 Create Charts and Graphs 295
Choose a Chart Type 296
Create a New Chart with the Chart Wizard 296
Select the Data for the Chart 296
Use the Access Chart Wizard 299
Save the Chart 302
Link the Chart to Record Data 302
Add an Existing Chart to a Form or Report 303
Modify the Chart 304
Modify with Access 305
Edit with Microsoft Graph 308
Trang 16PART III Improve the Access 2003 Workplace
CHAPTER 13 Customize the Workplace 319
Personalize the Workplace 320
Rearrange Icons 320
Create a Shortcut 321
Set Workplace Options 322
Create Custom Groups 333
Change the Way Access Starts 334
Modify the Office Assistant 337
Show and Hide 337
Set Office Assistant Options 337
Choose a Different Assistant 338
CHAPTER 14 Speed Up Your Database 341
Optimize a Database 342
Use the Analyzer Wizards 342
Optimize Tables and Queries 348
Optimize Filter By Form 350
Optimize Forms and Reports 350
Optimize Controls 351
Back Up and Restore a Database 352
Compact and Repair a Database 353
CHAPTER 15 Automate with Macros 357
Create a Simple Macro 358
Choose Macro Actions 359
Set Action Arguments 360
Test and Debug a Macro 361
Start the Macro 361
Step Through a Macro 362
Modify a Macro 363
Assign a Macro to an Event Property 363
Decide Which Event to Use 364
Add Conditions to a Macro 365
Create a Macro to Display a Warning 366
Create Other Commonly Used Macros 368
Set Control Values and Properties 368
Change the Flow of Operations 370
Filter Records 372
Create an AutoExec Macro 373
Create a Macro Group 373
Assign AutoKeys 375
Trang 17CHAPTER 16 Customize Menus and Toolbars 377
Use Access Command Bars 378
Show and Hide Built-in Toolbars 379
Show and Hide Toolbar Buttons 381
Move and Resize Command Bars 381
Change Menu and Toolbar Options 381
Customize Command Bars 383
Create a Global Toolbar 383
Create Custom Toolbars and Menu Bars 383
Attach a Custom Command Bar to an Object 391
Specify Global Command Bars 391
Delete a Custom Command Bar 392
Modify Command Bars 393
Move Controls 394
Add and Delete Controls 395
Edit Buttons and Menu Commands 395
Restore Built-in Command Bars 397
CHAPTER 17 Create Custom Switchboards and Dialog Boxes 399
Create Switchboards 400
Use the Switchboard Manager to Create Switchboards 401
Modify the Switchboard 408
Create a Custom Dialog Box 412
Design the Form 412
Create and Attach the Macros 414
Set Form Properties and Style 416
Create a Dialog Box for User Input 419
Set the Input Form Properties 419
Create the Macros 420
Modify the Query 421
PART IV Exchange Data with Others CHAPTER 18 Exchange Database Objects and Text 425
Copy Objects among Access Databases 426
Copy and Paste 426
Drag and Drop 427
Import or Link Access Data 428
Import Objects 428
Set Import Options 430
Link Access Tables 431
Import from or Link to Other Data Sources 432
Use Data from dBASE or Paradox 433
Trang 18Work with Linked or Imported Tables 434
Rename a Linked Table in Access 434
Change Linked Table Properties 435
Update Links with the Linked Table Manager 435
Unlink Tables 436
Import and Link Text Files 436
Use Delimited Text Files 436
Use Fixed-Width Text Files 440
Change Import Specifications 441
Export to an Existing Access Database 442
Export to Another Database Format 444
Export to Text Files 444
CHAPTER 19 Exchange Data with Outside Sources 447
Copy or Move Records 448
Copy or Move Data from a Word Processor 448
Copy or Move Data from a Spreadsheet 450
Copy or Move Records from Access to Another Application 450
Save Access Output as an External File 451
Work with Word 452
Save in Rich Text Format 453
Save an Access Table or Query as a Mail Merge Data Source 454
Publish with Word 454
Use Merge It with Word 455
Work with Excel 457
Import from and Link to Excel Spreadsheets 457
Export a Table or Query to Excel 462
Use Analyze It with Microsoft Excel 462
CHAPTER 20 Share with Multiple Users 465
Share a Database on a Network 466
Share an Entire Database 466
Split the Database 467
Prevent Exclusive Access 471
Replicate a Database 471
Manage the Database in a Multiuser Environment 472
Control Data Editing 473
Update Records with Refresh and Requery 476
Edit Shared Database Objects 476
CHAPTER 21 Secure a Database 477
Secure a Database with a Password 478
Secure a Multiple-User Database 479
Understand the User-Level Security Model 479
Trang 19What Is Needed to Secure a Database? 481
Secure a Database with the User-Level Security Wizard 481
Create a Workgroup Without the Wizard 486
Assign or Change Permissions and Ownerships 493
Remove User-Level Security 497
Other Security Measures 498
Encode and Decode a Database 498
Hide Database Objects 498
APPENDIX Convert to Access 2003 501
Decide on a Conversion Strategy 502
Convert a Database 502
Convert a Workgroup Information File 504
Convert a Secured Database 504
Convert a Replicated Database 504
Enable a Database 505
Share a Database Across Several Access Versions 506
Convert from Access 2002-2003 to Access 97 507
Convert from Access 2002-2003 to Access 2000 507
Index 509
Trang 20It has been a treat to be involved in the evolution of this new book series and it is also a pleasure
to revise the How to Do Everything for Microsoft Office Access 2003 My thanks go to the great
staff at McGraw-Hill/Osborne for all the help they provided I note especially Megg Morin, my
acquisitions editor, who, with skill and patience, guided me in the structure and tenor of this
book She is a pleasure to work with, as is all her staff Tana Allen and Athena Honore, my
acquisitions coordinators, skillfully juggled their many responsibilities, all the while being
responsive and helpful
I also owe many thanks to Jody McKenzie, the book’s project editor, for all her help inmoving the many chapters through the complex editing and production maze Her editorial
staff, including technical editor Margaret Levine Young and copy editor Andy Saff were very
conscientious in pointing out glitches in the logic and lapses in the style My sincere thanks
also go to Stefany Otis for proofing, to Valerie Perry for indexing, and to Jim Kussow and Dick
Schwartz for shipping this How To book The illustrators, Melinda Lytle, Kathleen Edwards,
and Lyssa Wald also did a great job with the art
I must mention how much I appreciate the unrelenting efforts my agent, Matt Wagner ofWaterside Productions, has put in to keep me from wasting my time by lolling around on the
beach for the last 13 years
Finally, I have my husband, Jack, to thank for providing quiet and peaceful surroundings,amenable to writing I also thank him for letting me take over his computer for the duration
while mine was occupied by the Office 2003 beta
Trang 21This page intentionally left blank
Trang 22The Microsoft Office Access 2003 database management system can be a powerful tool for you
whether you need to handle business or personal information The concept of distributing data among
related tables is not new, but the way the concept is implemented in Access 2003 makes information
management a snap Access 2003 is extremely flexible and can be applied to any environment
With Access, you can design and build complete applications with virtually foolproof dataentry and retrieval functions and adaptable user-interactive vehicles
Access’s main features are the objects that you can create and combine to produce acomplete information management system:
■ Tables are the containers for the data They consist of fields that can contain data ofmany different types
■ Queries are the questions you ask of the database They can extract specific data frommultiple tables or even perform actions such as insert, update, or delete certain records
■ Forms display data from one or more tables in an informative design Forms are usedfor data entry and display
■ Reports are used for distributing printed information from one or more tables
■ Macros are lists of actions that work together to carry out a particular task in response
to an event
As an integral member of the Microsoft Office 2003 family, Access 2003 has become verycooperative in working smoothly with the other members For example, it can provide the
mailing list for Word’s Mail Merge document or send data to Excel for analysis and charting
Access can also easily import and link to data in other program formats
Who Should Read this Book?
This book is especially designed and written for readers who want an effective guide to all the
Microsoft Office Access 2003 features, as well as for those who need a complete step-by-step
walk-through to learn how to get the most out of Access It is written for anyone who has a need
to organize information efficiently and accurately, whether for personal or business objectives
Trang 23The book is appropriate for beginners to Access who are familiar with computers and other
programs but who would like to become proficient in information management It is also highly
useful for beginner-to-intermediate readers who are migrating from other database management
systems or earlier versions of Access
This book focuses on how you can get the most out of Access, whether you are responsiblefor your company’s complete information system or just want to keep track of personal
information on your home computer
What’s in Each Part of the Book?
The book is divided into four parts, each of which addresses a specific aspect of Access database
management in a logical sequence, from a simple beginning to complex multiple user environment.Part I gives you a general overview of Access, and addresses the basics of creating a newdatabase with related tables, and entering data in the tables
Part II gets to the meat of database management by describing how to build queries toextract just the information you want, in the form you want it Part II also shows you how to
create forms and reports for displaying and distributing data One of the chapters describes how
to analyze data with visual charts and graphs
Part III diverts from database management to discuss personalizing your workplace andimproving database performance It describes how to create custom menus and toolbars, as well
as switchboards and dialog boxes Macros are also introduced in this part
Part IV looks outward from Access and investigates the exchange of data with other programs,including database applications It also investigates the sharing of an Access database among
multiple users, employing replication techniques, and describes various means of securing the
database from intentional and unintentional disruption
The Appendix shows how to convert a database from previous versions of Access In addition,
it describes how to deal with sharing a database across several different versions
What Features and Benefits Are Included?
Many helpful editorial elements are presented in this book, including the chapter-opening
checklist of How To topics that are covered in the chapter If you are new to Access, you may
want to start at the beginning of the book and read each chapter carefully Work the step-by-step
exercises as much as possible to gain important “hands-on” experience If you have used earlier
versions of Access, you may want to skim through the How To lists for material that is new
to you
You will find all the information you need to perform a specific task clustered together in
a single chapter with cross-references to other chapters that may contain related information
Trang 24In addition to the explanations in the text, every chapter presents relevant and interestingfigures and illustrations that clearly depict the activity under discussion Other elements are
included such as:
■ Tips with graphics and text that point out alternative ways to use a feature
■ Cautions that warn the reader of pitfalls and workarounds that can avoid problems
■ Notes that contain ancillary information related to the current topic but not part of the action
■ Shortcuts in the form of a graphic icon that suggest ways to save time with a particular task
■ How To and Did You Know? sidebars that contain additional, peripheral information aboutthe process at hand
The following conventions are used in this book:
■ Menu commands are separated by pipebars; for example, File | Open This means selectthe Open command on the File menu
■ Click means to click an item once, using the left mouse button
■ Double-click means to click an item twice in rapid succession, using the left mouse button
■ Right-click means to click an item once, using the right mouse button
■ Procedural steps that are numbered must be carried out in the prescribed order
■ Optional choices are presented as bulleted lists from which to choose
Let Me Hear from You
After a book leaves my domain, there is always a sense of waiting for the other shoe to drop
If you have any comments about how to make this book better, or you want to share some of
your experiences with Access, I would be delighted to hear from you I have enjoyed hearing
from readers from as far away as India, China, Scotland, and Korea Just drop me a line at my
email address: VAndersenZ@aol.com
Trang 25This page intentionally left blank
Trang 26Part I Get Started
Trang 27This page intentionally left blank
Trang 28Chapter 1 with Access 2003