access 2003 bible table of contents - wiley€¦ · xxxvi access 2003 bible creating a new table ....

22
Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxi Part I: Creating Desktop Applications 1 Section I: Working with Data Tables and Queries 1 Chapter 1: Understanding Data . . . . . . . . . . . . . . . . . . . . . . . 3 The Database Terminology of Access . . . . . . . . . . . . . . . . . . . . . . . 4 What is a database? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Databases, tables, records, fields, and values . . . . . . . . . . . . . . . 5 Using More Than One Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Working with multiple tables . . . . . . . . . . . . . . . . . . . . . . . . 8 Why you should create multiple tables . . . . . . . . . . . . . . . . . . 8 Access Database Objects and Views . . . . . . . . . . . . . . . . . . . . . . . 9 Datasheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Queries and dynasets . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Data-entry and display forms . . . . . . . . . . . . . . . . . . . . . . . 10 Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Designing the system’s objects . . . . . . . . . . . . . . . . . . . . . . 11 The Seven-Step Design Method . . . . . . . . . . . . . . . . . . . . . . . . . 12 Step 1: The overall design — From concept to reality . . . . . . . . . . 13 Step 2: Report design — Placing your fields . . . . . . . . . . . . . . . 15 Step 3: Data design — What fields do you have? . . . . . . . . . . . . . 17 Step 4: Table design and relationships . . . . . . . . . . . . . . . . . . 24 Step 5: Field design data-entry rules and validation . . . . . . . . . . 27 Step 6: Form design — Input . . . . . . . . . . . . . . . . . . . . . . . . 30 Step 7: Automation design — Menus . . . . . . . . . . . . . . . . . . . 32 Chapter 2: Creating and Building Tables . . . . . . . . . . . . . . . . . 35 Creating Database Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Creating a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Templates Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Blank database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 The Database Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Objects menu bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Groups menu bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 The Database window toolbar buttons . . . . . . . . . . . . . . . . . . 44 The Access window toolbar . . . . . . . . . . . . . . . . . . . . . . . . 44

Upload: hoangliem

Post on 08-Oct-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

ContentsPreface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi

Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxi

Part I: Creating Desktop Applications 1

Section I: Working with Data Tables and Queries 1

Chapter 1: Understanding Data . . . . . . . . . . . . . . . . . . . . . . . 3The Database Terminology of Access . . . . . . . . . . . . . . . . . . . . . . . 4

What is a database? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4Databases, tables, records, fields, and values . . . . . . . . . . . . . . . 5

Using More Than One Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Working with multiple tables . . . . . . . . . . . . . . . . . . . . . . . . 8Why you should create multiple tables . . . . . . . . . . . . . . . . . . 8

Access Database Objects and Views . . . . . . . . . . . . . . . . . . . . . . . 9Datasheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9Queries and dynasets . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10Data-entry and display forms . . . . . . . . . . . . . . . . . . . . . . . 10Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Designing the system’s objects . . . . . . . . . . . . . . . . . . . . . . 11

The Seven-Step Design Method . . . . . . . . . . . . . . . . . . . . . . . . . 12Step 1: The overall design — From concept to reality . . . . . . . . . . 13Step 2: Report design — Placing your fields . . . . . . . . . . . . . . . 15Step 3: Data design — What fields do you have? . . . . . . . . . . . . . 17Step 4: Table design and relationships . . . . . . . . . . . . . . . . . . 24Step 5: Field design data-entry rules and validation . . . . . . . . . . 27Step 6: Form design — Input . . . . . . . . . . . . . . . . . . . . . . . . 30Step 7: Automation design — Menus . . . . . . . . . . . . . . . . . . . 32

Chapter 2: Creating and Building Tables . . . . . . . . . . . . . . . . . 35Creating Database Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35Creating a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

Templates Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37Blank database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

The Database Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41Objects menu bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42Groups menu bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43The Database window toolbar buttons . . . . . . . . . . . . . . . . . . 44The Access window toolbar . . . . . . . . . . . . . . . . . . . . . . . . 44

539868 FM.qxd 9/11/03 10:29 PM Page xxxv

Page 2: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

xxxvi Access 2003 Bible

Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46The table design process . . . . . . . . . . . . . . . . . . . . . . . . . . 46The New Table dialog box . . . . . . . . . . . . . . . . . . . . . . . . . 47Creating a new table with a Datasheet View . . . . . . . . . . . . . . . 49

The Table Design Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51Using the Table Design window toolbar . . . . . . . . . . . . . . . . . 52Working with fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

Creating the tblContacts Table . . . . . . . . . . . . . . . . . . . . . . . . . . 56AutoNumber fields and Access . . . . . . . . . . . . . . . . . . . . . . 56Completing the tblContacts Table . . . . . . . . . . . . . . . . . . . . . 57

Changing a Table Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59Inserting a new field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59Deleting a field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59Changing a field location . . . . . . . . . . . . . . . . . . . . . . . . . . 60Changing a field name . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60Changing a field size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60Changing a field data type . . . . . . . . . . . . . . . . . . . . . . . . . 61

Understanding Field Properties . . . . . . . . . . . . . . . . . . . . . . . . . 62Entering field-size properties . . . . . . . . . . . . . . . . . . . . . . . 64Using formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65Entering formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69Entering input masks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70The Input Mask Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . 72Entering decimal places . . . . . . . . . . . . . . . . . . . . . . . . . . 73Creating a caption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73Setting a default value . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73Working with validation . . . . . . . . . . . . . . . . . . . . . . . . . . . 73Understanding the Lookup Property window . . . . . . . . . . . . . . 76

Determining the Primary Key . . . . . . . . . . . . . . . . . . . . . . . . . . . 76Creating a unique key . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77Creating the primary key . . . . . . . . . . . . . . . . . . . . . . . . . . 78The Indexes window . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78The Table Properties window . . . . . . . . . . . . . . . . . . . . . . . 79

Printing a Table Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80Saving the Completed Table . . . . . . . . . . . . . . . . . . . . . . . . . . . 81Manipulating Tables in a Database Window . . . . . . . . . . . . . . . . . . 81

Renaming tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81Deleting tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82Copying tables in a database . . . . . . . . . . . . . . . . . . . . . . . . 82Copying a table to another database . . . . . . . . . . . . . . . . . . . 83

Adding Records to a Database Table . . . . . . . . . . . . . . . . . . . . . . 83

Chapter 3: Entering Data into Tables and Forms . . . . . . . . . . . . 85Understanding Datasheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85The Datasheet Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

Moving within a datasheet . . . . . . . . . . . . . . . . . . . . . . . . . 88The Navigation buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . 88The Datasheet toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

539868 FM.qxd 9/11/03 10:29 PM Page xxxvi

Page 3: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

xxxviiContents

Opening a Datasheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92Entering New Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

Saving the record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94Understanding automatic data-type validation . . . . . . . . . . . . . 95Understanding how properties affect data entry . . . . . . . . . . . . 96

Navigating Records in a Datasheet . . . . . . . . . . . . . . . . . . . . . . . . 98Moving between records . . . . . . . . . . . . . . . . . . . . . . . . . . 98Finding a specific value . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

Changing Values in a Datasheet . . . . . . . . . . . . . . . . . . . . . . . . . 102Replacing an existing value manually . . . . . . . . . . . . . . . . . . 102Changing an existing value . . . . . . . . . . . . . . . . . . . . . . . . 103Fields that you can’t edit . . . . . . . . . . . . . . . . . . . . . . . . . 104

Using the Undo Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104Copying and Pasting Values . . . . . . . . . . . . . . . . . . . . . . . . . . . 105Replacing Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105Adding New Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106Deleting Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107Adding, Changing, and Deleting Columns . . . . . . . . . . . . . . . . . . . 107

Deleting a column from a datasheet . . . . . . . . . . . . . . . . . . . 108Adding a column to a datasheet . . . . . . . . . . . . . . . . . . . . . 108Changing a field name (column header) . . . . . . . . . . . . . . . . . 108

Displaying Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108Changing the field order . . . . . . . . . . . . . . . . . . . . . . . . . . 108Changing the field display width . . . . . . . . . . . . . . . . . . . . . 110Changing the record display height . . . . . . . . . . . . . . . . . . . 111Displaying cell gridlines . . . . . . . . . . . . . . . . . . . . . . . . . . 112Changing display fonts . . . . . . . . . . . . . . . . . . . . . . . . . . 113Hiding and unhiding columns . . . . . . . . . . . . . . . . . . . . . . . 114Freezing columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115Saving the changed layout . . . . . . . . . . . . . . . . . . . . . . . . 115Saving a record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

Sorting and Filtering Records in a Datasheet . . . . . . . . . . . . . . . . . 115Using the QuickSort feature . . . . . . . . . . . . . . . . . . . . . . . . 116Using Filter By Selection . . . . . . . . . . . . . . . . . . . . . . . . . . 116Using Filter By Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118

Printing Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118Printing the datasheet . . . . . . . . . . . . . . . . . . . . . . . . . . . 119Using the Print Preview window . . . . . . . . . . . . . . . . . . . . . 119

Chapter 4: Creating and Understanding Relationships . . . . . . . . 123Tables Used in the Access Auto Auctions Database . . . . . . . . . . . . . 123Understanding Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126

Deciding on a primary key . . . . . . . . . . . . . . . . . . . . . . . . 128Benefits of a primary key . . . . . . . . . . . . . . . . . . . . . . . . . 129Creating a primary key . . . . . . . . . . . . . . . . . . . . . . . . . . 130Understanding foreign keys . . . . . . . . . . . . . . . . . . . . . . . . 132

Understanding Relations between Tables . . . . . . . . . . . . . . . . . . . 132A review of relationships . . . . . . . . . . . . . . . . . . . . . . . . . 133Understanding the four types of table relationships . . . . . . . . . 133

539868 FM.qxd 9/11/03 10:29 PM Page xxxvii

Page 4: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

xxxviii Access 2003 Bible

Understanding Referential Integrity . . . . . . . . . . . . . . . . . . . . . . 136Creating Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

Using the Relationships window . . . . . . . . . . . . . . . . . . . . . 137Creating relationships between tables . . . . . . . . . . . . . . . . . 139Specifying relationship options in the

Edit Relationships dialog box . . . . . . . . . . . . . . . . . . . . . 140Finishing the relationships between the tables

of the Access Auto Auctions system . . . . . . . . . . . . . . . . . 144Saving the relationships between tables . . . . . . . . . . . . . . . . 146Adding another relationship . . . . . . . . . . . . . . . . . . . . . . . 146Deleting an existing relationship . . . . . . . . . . . . . . . . . . . . . 147Join lines in the Relationships window . . . . . . . . . . . . . . . . . 147Printing a report of the relationships . . . . . . . . . . . . . . . . . . 147

Using Subdatasheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148Setting up sub-datasheets . . . . . . . . . . . . . . . . . . . . . . . . . 149

Chapter 5: Displaying Selected Data with Queries . . . . . . . . . . 153Understanding Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

What is a query? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154Types of queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156Query capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157How dynasets work . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

Creating a Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158Selecting a table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159Using the Query window . . . . . . . . . . . . . . . . . . . . . . . . . 161Navigating the Query Design window . . . . . . . . . . . . . . . . . . 161Using the Query Design toolbar . . . . . . . . . . . . . . . . . . . . . 162Using the QBE pane of the Query Design window . . . . . . . . . . . 163

Selecting Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163Adding a single field . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163Adding multiple fields . . . . . . . . . . . . . . . . . . . . . . . . . . . 165Adding all table fields . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

Displaying the Dynaset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167Working with the datasheet . . . . . . . . . . . . . . . . . . . . . . . . 168Changing data in the query datasheet . . . . . . . . . . . . . . . . . . 168Returning to the query design . . . . . . . . . . . . . . . . . . . . . . 168

Working with Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168Selecting a field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168Changing field order . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170Resizing columns in design mode . . . . . . . . . . . . . . . . . . . . 170Removing a field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171Inserting a field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171Changing the field display name . . . . . . . . . . . . . . . . . . . . . 171Showing table names . . . . . . . . . . . . . . . . . . . . . . . . . . . 172Showing a field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

Changing the Sort Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173Specifying a sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

539868 FM.qxd 9/11/03 10:29 PM Page xxxviii

Page 5: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

xxxixContents

Displaying Only Selected Records . . . . . . . . . . . . . . . . . . . . . . . 175Understanding record criteria . . . . . . . . . . . . . . . . . . . . . . 175Entering simple character criteria . . . . . . . . . . . . . . . . . . . . 176Entering other simple criteria . . . . . . . . . . . . . . . . . . . . . . 177

Printing a Query Dynaset . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178Saving a Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179Adding More than One Table to a Query . . . . . . . . . . . . . . . . . . . . 180Working with the Table/Query Pane . . . . . . . . . . . . . . . . . . . . . . 181

The join line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181Resizing the Table/Query pane . . . . . . . . . . . . . . . . . . . . . . 182Manipulating the Field List window . . . . . . . . . . . . . . . . . . . 184Moving a table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184Removing a table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184Adding more tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185Resizing a Field List window . . . . . . . . . . . . . . . . . . . . . . . 185

Adding Fields from More than One Table . . . . . . . . . . . . . . . . . . . 185Adding a single field . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185Viewing the table names . . . . . . . . . . . . . . . . . . . . . . . . . 186Adding multiple fields at the same time . . . . . . . . . . . . . . . . . 186Adding all table fields . . . . . . . . . . . . . . . . . . . . . . . . . . . 187

Understanding the Limitations of Multiple-Table Queries . . . . . . . . . . 188Updating limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188Overcoming query limitations . . . . . . . . . . . . . . . . . . . . . . 190

Creating and Working with Query Joins . . . . . . . . . . . . . . . . . . . . 191Joining tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192Specify the type of join . . . . . . . . . . . . . . . . . . . . . . . . . . 193Deleting joins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194

Understanding Types of Table Joins . . . . . . . . . . . . . . . . . . . . . . 195Inner joins (Equi-joins) . . . . . . . . . . . . . . . . . . . . . . . . . . 195Changing join properties . . . . . . . . . . . . . . . . . . . . . . . . . 196Inner and outer joins . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198Creating a Cartesian product . . . . . . . . . . . . . . . . . . . . . . . 201

Chapter 6: Using Operators and Expressions in Multi-table Select Queries . . . . . . . . . . . . . . . . 203

What Are Operators? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203Types of operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204When are operators used? . . . . . . . . . . . . . . . . . . . . . . . . 204Mathematical operators . . . . . . . . . . . . . . . . . . . . . . . . . . 204Relational operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208String operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210Boolean (logical) operators . . . . . . . . . . . . . . . . . . . . . . . . 213Miscellaneous operators . . . . . . . . . . . . . . . . . . . . . . . . . 216Operator precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . 217

Moving beyond Simple Queries . . . . . . . . . . . . . . . . . . . . . . . . . 219Using query comparison operators . . . . . . . . . . . . . . . . . . . 220Understanding complex criteria selection . . . . . . . . . . . . . . . 222Using functions in select queries . . . . . . . . . . . . . . . . . . . . . 225Referencing fields in select queries . . . . . . . . . . . . . . . . . . . 226

539868 FM.qxd 9/11/03 10:29 PM Page xxxix

Page 6: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

xl Access 2003 Bible

Entering Single-Value Field Criteria . . . . . . . . . . . . . . . . . . . . . . . 226Entering character (Text or Memo) criteria . . . . . . . . . . . . . . 227The Like operator and wildcards . . . . . . . . . . . . . . . . . . . . . 228Specifying non-matching values . . . . . . . . . . . . . . . . . . . . . 232Entering numeric (Number, Currency, or Counter) criteria . . . . . . 233Entering Yes/No (logic) criteria . . . . . . . . . . . . . . . . . . . . . 234Entering a criterion for an OLE object . . . . . . . . . . . . . . . . . . 235

Entering Multiple Criteria in One Field . . . . . . . . . . . . . . . . . . . . . 235Understanding an Or operation . . . . . . . . . . . . . . . . . . . . . 236Specifying multiple values for a field using the Or operator . . . . . 236Using the Or: cell of the QBE pane . . . . . . . . . . . . . . . . . . . . 237Using a list of values with the In operator . . . . . . . . . . . . . . . 238Understanding an And query . . . . . . . . . . . . . . . . . . . . . . . 238Specifying a range using the And operator . . . . . . . . . . . . . . . 239Using the Between...And operator . . . . . . . . . . . . . . . . . . . . 239Searching for Null data . . . . . . . . . . . . . . . . . . . . . . . . . . 240

Entering Criteria in Multiple Fields . . . . . . . . . . . . . . . . . . . . . . . 241Using And and Or across fields in a query . . . . . . . . . . . . . . . 241Specifying And criteria across fields of a query . . . . . . . . . . . . 242Specifying Or criteria across fields of a query . . . . . . . . . . . . . 243Using And and Or together in different fields . . . . . . . . . . . . . . 244A complex query on different lines . . . . . . . . . . . . . . . . . . . 245

Creating a New Calculated Field in a Query . . . . . . . . . . . . . . . . . . 246

Chapter 7: Working with External Data . . . . . . . . . . . . . . . . . 247Access and External Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

Types of external data . . . . . . . . . . . . . . . . . . . . . . . . . . . 248Methods of working with external data . . . . . . . . . . . . . . . . . 248Should you link to or import data? . . . . . . . . . . . . . . . . . . . . 249

Linking External Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252Types of database management systems . . . . . . . . . . . . . . . . 252Linking to other Access database tables . . . . . . . . . . . . . . . . 255Linking to dBASE databases (tables) . . . . . . . . . . . . . . . . . . 257Linking to Paradox tables . . . . . . . . . . . . . . . . . . . . . . . . . 259Linking to non-database tables . . . . . . . . . . . . . . . . . . . . . . 261Splitting an Access database into two linked databases . . . . . . . 267

Working with Linked Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . 269Setting view properties . . . . . . . . . . . . . . . . . . . . . . . . . . 270Setting relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270Setting links between external tables . . . . . . . . . . . . . . . . . . 271Using external tables in queries . . . . . . . . . . . . . . . . . . . . . 271Renaming tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273Optimizing linked tables . . . . . . . . . . . . . . . . . . . . . . . . . . 273Deleting a linked table reference . . . . . . . . . . . . . . . . . . . . . 274Viewing or changing information for linked tables . . . . . . . . . . . 274

Importing External Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275Importing other Access objects . . . . . . . . . . . . . . . . . . . . . 276Importing non-Access PC-based database tables . . . . . . . . . . . 277Importing spreadsheet data . . . . . . . . . . . . . . . . . . . . . . . 279

539868 FM.qxd 9/11/03 10:29 PM Page xl

Page 7: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

xliContents

Importing from word-processing files . . . . . . . . . . . . . . . . . . 282Importing text file data . . . . . . . . . . . . . . . . . . . . . . . . . . 282Importing HTML tables . . . . . . . . . . . . . . . . . . . . . . . . . . 293Modifying imported table elements . . . . . . . . . . . . . . . . . . . 293Troubleshooting import errors . . . . . . . . . . . . . . . . . . . . . . 294

Exporting to External Formats . . . . . . . . . . . . . . . . . . . . . . . . . 295Exporting objects to other Access databases . . . . . . . . . . . . . 296Exporting objects to other external databases

or to Excel, HTML, or text files . . . . . . . . . . . . . . . . . . . . 296

Part I: Creating Desktop Applications 299

Section II: Building Forms and Reports 299

Chapter 8: Understanding the Many Uses of Forms and Controls. . . 301Understanding Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301

What are the basic types of forms? . . . . . . . . . . . . . . . . . . . 302How do forms differ from datasheets? . . . . . . . . . . . . . . . . . . 305Creating a form with AutoForm . . . . . . . . . . . . . . . . . . . . . . 306

Understanding Form Controls . . . . . . . . . . . . . . . . . . . . . . . . . . 309What Is a Control? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309

The different control types . . . . . . . . . . . . . . . . . . . . . . . . 310Standards for Using Controls . . . . . . . . . . . . . . . . . . . . . . . . . . 312

Label controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313Text box controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314Toggle buttons, option buttons, and check boxes . . . . . . . . . . . 314Option groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316List boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317Combo boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318Tab controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318

Chapter 9: Building and Manipulating Forms and Controls . . . . . 321Creating a Form with Form Wizards . . . . . . . . . . . . . . . . . . . . . . 321

Creating a new form . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321Selecting the New Form type and data source . . . . . . . . . . . . . 322Choosing the fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323Choosing the form layout . . . . . . . . . . . . . . . . . . . . . . . . . 324Choosing the style of the form . . . . . . . . . . . . . . . . . . . . . . 325Creating a form title . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326Completing the form . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327

Changing the Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327Using the Form Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329

The Form toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329Navigating between fields . . . . . . . . . . . . . . . . . . . . . . . . . 329Moving between records in a form . . . . . . . . . . . . . . . . . . . . 330

539868 FM.qxd 9/11/03 10:30 PM Page xli

Page 8: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

xlii Access 2003 Bible

Displaying Your Data with a Form . . . . . . . . . . . . . . . . . . . . . . . 331Working with pictures and OLE objects . . . . . . . . . . . . . . . . . 331Memo field data entry . . . . . . . . . . . . . . . . . . . . . . . . . . . 332Switching to a datasheet . . . . . . . . . . . . . . . . . . . . . . . . . 332

Saving a Record and the Form . . . . . . . . . . . . . . . . . . . . . . . . . 333Printing a Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333

Using the Print Preview window . . . . . . . . . . . . . . . . . . . . . 334Creating New Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335

Resizing the form area . . . . . . . . . . . . . . . . . . . . . . . . . . . 336The two ways to add a control . . . . . . . . . . . . . . . . . . . . . . 336Dragging a field name from the Field List window . . . . . . . . . . . 337Creating unbound controls with the toolbox . . . . . . . . . . . . . . 338

Selecting Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340Deselecting selected controls . . . . . . . . . . . . . . . . . . . . . . 341Selecting a single control . . . . . . . . . . . . . . . . . . . . . . . . . 341Selecting multiple controls . . . . . . . . . . . . . . . . . . . . . . . . 341

Manipulating Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342Resizing a control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342Moving a control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343Aligning controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344Sizing controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345Grouping controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346Deleting a control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347Attaching a label to a control . . . . . . . . . . . . . . . . . . . . . . . 347Copying a control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348

Chapter 10: Creating Bound Forms and Placing Controls . . . . . . . 349Creating a Data-Entry Form without a Wizard . . . . . . . . . . . . . . . . . 349

Creating a new blank form . . . . . . . . . . . . . . . . . . . . . . . . 350Resizing the form’s workspace . . . . . . . . . . . . . . . . . . . . . . 350Understanding the design windows . . . . . . . . . . . . . . . . . . . 353Creating a bound form . . . . . . . . . . . . . . . . . . . . . . . . . . . 355Saving the form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356Working with control properties . . . . . . . . . . . . . . . . . . . . . 357Working with form properties . . . . . . . . . . . . . . . . . . . . . . 362

Placing Bound Fields on a Form . . . . . . . . . . . . . . . . . . . . . . . . . 372Displaying the field list . . . . . . . . . . . . . . . . . . . . . . . . . . 373Selecting the fields for your form . . . . . . . . . . . . . . . . . . . . 373

Adding a Form Header or Footer . . . . . . . . . . . . . . . . . . . . . . . . 375Working with Label Controls and Text Box Controls . . . . . . . . . . . . . 376

Creating unattached labels . . . . . . . . . . . . . . . . . . . . . . . . 376Modifying the text in a label or text control . . . . . . . . . . . . . . 377Modifying the format of text in a control . . . . . . . . . . . . . . . . 378Sizing a text box control or label control . . . . . . . . . . . . . . . . 379Deleting a control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381Moving label and text controls . . . . . . . . . . . . . . . . . . . . . . 381Modifying the appearance of multiple controls . . . . . . . . . . . . 382Changing the control type . . . . . . . . . . . . . . . . . . . . . . . . . 383

539868 FM.qxd 9/11/03 10:30 PM Page xlii

Page 9: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

xliiiContents

Setting the Tab Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384Using Multiple-Line Text Box Controls for Memo Fields . . . . . . . . . . . 386Working with Bound Object Frames on a Form . . . . . . . . . . . . . . . . 387Creating a Calculated Field . . . . . . . . . . . . . . . . . . . . . . . . . . . 387Fixing a Picture’s Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388Printing a Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389Converting a Form to a Report . . . . . . . . . . . . . . . . . . . . . . . . . 390

Chapter 11: Adding Data-Validation Features to Forms . . . . . . . . 391Creating Data-Validation Expressions . . . . . . . . . . . . . . . . . . . . . 392

Creating status line messages . . . . . . . . . . . . . . . . . . . . . . 393Entering table level validation expressions . . . . . . . . . . . . . . . 394Entering validation expressions . . . . . . . . . . . . . . . . . . . . . 394

Creating Choices with Option Groups and Buttons . . . . . . . . . . . . . 395Creating option groups . . . . . . . . . . . . . . . . . . . . . . . . . . 397

Creating Yes/No Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403Creating check boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . 403

Creating Visual Selections with Toggle Buttons . . . . . . . . . . . . . . . . 405Adding a bitmapped image to the toggle button . . . . . . . . . . . . 405

Working with List Boxes and Combo Boxes . . . . . . . . . . . . . . . . . . 406The differences between list boxes and combo boxes . . . . . . . . 406Settling real-estate issues . . . . . . . . . . . . . . . . . . . . . . . . . 407

Creating and Using Combo Boxes . . . . . . . . . . . . . . . . . . . . . . . . 407Creating a single-column combo box . . . . . . . . . . . . . . . . . . 408Understanding combo box properties . . . . . . . . . . . . . . . . . . 411Creating a multiple-column combo box . . . . . . . . . . . . . . . . . 412

Chapter 12: Creating Professional-Looking Forms and Reports . . . 421Making a Good Form Look Great . . . . . . . . . . . . . . . . . . . . . . . . 421

Understanding visual design . . . . . . . . . . . . . . . . . . . . . . . 422Using the formatting windows and toolbar . . . . . . . . . . . . . . . 423Creating special effects . . . . . . . . . . . . . . . . . . . . . . . . . . 425Changing the forms background color . . . . . . . . . . . . . . . . . 427

Enhancing Text-Based Controls . . . . . . . . . . . . . . . . . . . . . . . . . 427Enhancing label and text box controls . . . . . . . . . . . . . . . . . 427Creating a text shadow . . . . . . . . . . . . . . . . . . . . . . . . . . 428Changing text to a reverse video display and coloring it . . . . . . . 429Displaying label or text box control properties . . . . . . . . . . . . 430

Displaying Images in Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . 433Working with Lines and Rectangles . . . . . . . . . . . . . . . . . . . . . . . 436Emphasizing Areas of the Form . . . . . . . . . . . . . . . . . . . . . . . . . 437

Adding a shadow to a control . . . . . . . . . . . . . . . . . . . . . . 438Raising a group of controls . . . . . . . . . . . . . . . . . . . . . . . . 438Changing the header dividing line . . . . . . . . . . . . . . . . . . . . 439

Adding a Background Bitmap . . . . . . . . . . . . . . . . . . . . . . . . . . 439Using AutoFormat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440

Customizing and adding new AutoFormats . . . . . . . . . . . . . . . 441Copying individual formats between controls . . . . . . . . . . . . . 442

539868 FM.qxd 9/11/03 10:30 PM Page xliii

Page 10: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

xliv Access 2003 Bible

Chapter 13: Understanding and Creating Reports . . . . . . . . . . . 443Understanding Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443

What types of reports can you create? . . . . . . . . . . . . . . . . . 443The difference between reports and forms . . . . . . . . . . . . . . . 446The process of creating a report . . . . . . . . . . . . . . . . . . . . . 447

Creating a Report with Report Wizards . . . . . . . . . . . . . . . . . . . . 448Creating a new report . . . . . . . . . . . . . . . . . . . . . . . . . . . 449Choosing the data source . . . . . . . . . . . . . . . . . . . . . . . . . 450Choosing the fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450Selecting the grouping levels . . . . . . . . . . . . . . . . . . . . . . . 451Defining the group data . . . . . . . . . . . . . . . . . . . . . . . . . . 452Selecting the sort order . . . . . . . . . . . . . . . . . . . . . . . . . . 453Selecting summary options . . . . . . . . . . . . . . . . . . . . . . . . 453Selecting the layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454Choosing the style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454Opening the report design . . . . . . . . . . . . . . . . . . . . . . . . 455Using the Print Preview window . . . . . . . . . . . . . . . . . . . . . 456Viewing the Report Design window . . . . . . . . . . . . . . . . . . . 457

Printing a Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458Saving the Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458Starting with a Blank Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459

The Design Window toolbar . . . . . . . . . . . . . . . . . . . . . . . 460Banded Report Writer Concepts . . . . . . . . . . . . . . . . . . . . . . . . 461

How sections process data . . . . . . . . . . . . . . . . . . . . . . . . 462The Report Writer sections . . . . . . . . . . . . . . . . . . . . . . . . 464

Creating a New Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467Creating a new report and binding it to a query . . . . . . . . . . . . 468Defining the report page size and layout . . . . . . . . . . . . . . . . 469Placing fields on the report . . . . . . . . . . . . . . . . . . . . . . . . 472Resizing a section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474Working with unattached label controls and text . . . . . . . . . . . 475Working with text boxes and their attached label controls . . . . . . 477Changing label and text box control properties . . . . . . . . . . . . 484Growing and shrinking text box controls . . . . . . . . . . . . . . . . 486Sorting and grouping data . . . . . . . . . . . . . . . . . . . . . . . . . 487Adding page breaks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493

Making the Report Presentation Quality . . . . . . . . . . . . . . . . . . . . 494Adjusting the Page Header . . . . . . . . . . . . . . . . . . . . . . . . 495Creating an expression in the Group Header . . . . . . . . . . . . . . 497Changing the picture properties and the Detail section . . . . . . . . 497Creating a standard page footer . . . . . . . . . . . . . . . . . . . . . 498Saving your report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500

Chapter 14: Working with Subforms . . . . . . . . . . . . . . . . . . . 503What Is a Subform? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503

Understand the data for the sales example . . . . . . . . . . . . . . . 505

539868 FM.qxd 9/11/03 10:30 PM Page xliv

Page 11: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

xlvContents

Creating Subforms with the Form Wizard . . . . . . . . . . . . . . . . . . . 507Creating the form and selecting the Form Wizard . . . . . . . . . . . 508Choosing the fields for the main form . . . . . . . . . . . . . . . . . . 508Selecting the table or query that will be the subform . . . . . . . . . 508Choosing the fields for the subform . . . . . . . . . . . . . . . . . . . 510Selecting the form data layout . . . . . . . . . . . . . . . . . . . . . . 510Selecting the subform layout . . . . . . . . . . . . . . . . . . . . . . . 511Selecting the form style . . . . . . . . . . . . . . . . . . . . . . . . . . 512Selecting the form title . . . . . . . . . . . . . . . . . . . . . . . . . . 512Displaying the form . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512Displaying the main form design . . . . . . . . . . . . . . . . . . . . . 514Linking a form and subform . . . . . . . . . . . . . . . . . . . . . . . . 515Displaying the subform design . . . . . . . . . . . . . . . . . . . . . . 516

Creating the Sales Invoice Form . . . . . . . . . . . . . . . . . . . . . . . . . 517Creating a combo box that retrieves data . . . . . . . . . . . . . . . . 518Displaying data from another table in a form . . . . . . . . . . . . . . 520

Creating a Subform Without Wizards . . . . . . . . . . . . . . . . . . . . . . 524Working with Continuous Form subforms . . . . . . . . . . . . . . . 525Adding the subform to the main form . . . . . . . . . . . . . . . . . . 531Linking the form and subform . . . . . . . . . . . . . . . . . . . . . . 533Referencing controls in subforms . . . . . . . . . . . . . . . . . . . . 534Creating a simple calculated control . . . . . . . . . . . . . . . . . . 537

Chapter 15: Creating Calculations and Summaries in Reports . . . . 539Designing a Full-Page Report with Embedded Subforms and Totals . . . . 539

Designing and creating the query for the report . . . . . . . . . . . . 540Designing test data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541Examining the Invoice report design . . . . . . . . . . . . . . . . . . 543Adding an unbound picture to the report . . . . . . . . . . . . . . . . 545Adding the Payments subform . . . . . . . . . . . . . . . . . . . . . . 547Creating a subreport reference to a summary control . . . . . . . . 550

Creating a Multilevel Grouping Report with Totals . . . . . . . . . . . . . . 552Creating a total query . . . . . . . . . . . . . . . . . . . . . . . . . . . 553Creating a query that uses a query . . . . . . . . . . . . . . . . . . . 557Creating a new columnar report . . . . . . . . . . . . . . . . . . . . . 558Changing the report design . . . . . . . . . . . . . . . . . . . . . . . . 563Changing the report margins and page setup . . . . . . . . . . . . . 570Calculating percentages using totals . . . . . . . . . . . . . . . . . . 571Calculating running sums . . . . . . . . . . . . . . . . . . . . . . . . . 572Creating a title page in a report header . . . . . . . . . . . . . . . . . 573

Chapter 16: Presenting Data with Special Report Types. . . . . . . . 575Creating Mailing Labels Using the Label Wizard . . . . . . . . . . . . . . . 575

Selecting the label size . . . . . . . . . . . . . . . . . . . . . . . . . . 576Selecting the font and color . . . . . . . . . . . . . . . . . . . . . . . . 578Creating the mailing label text and fields . . . . . . . . . . . . . . . . 578Sorting the mailing labels . . . . . . . . . . . . . . . . . . . . . . . . . 580

539868 FM.qxd 9/11/03 10:30 PM Page xlv

Page 12: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

xlvi Access 2003 Bible

Displaying the labels in the Print Preview window . . . . . . . . . . 580Modifying the label design in the Report Design window . . . . . . . 582Printing labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584

Creating Snaked-Column Reports . . . . . . . . . . . . . . . . . . . . . . . . 585Creating the report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586Defining the page setup . . . . . . . . . . . . . . . . . . . . . . . . . . 587Printing the snaked-column report . . . . . . . . . . . . . . . . . . . 588

Creating Mail Merge Reports . . . . . . . . . . . . . . . . . . . . . . . . . . 589Assembling data for a mail merge report . . . . . . . . . . . . . . . . 589Creating a mail merge report . . . . . . . . . . . . . . . . . . . . . . . 592Creating the page header area . . . . . . . . . . . . . . . . . . . . . . 592Working with embedded fields in text . . . . . . . . . . . . . . . . . . 594Printing the mail merge report . . . . . . . . . . . . . . . . . . . . . . 597

Using the Access Mail Merge Wizard for Microsoft Word . . . . . . . . . . 597

Chapter 17: Using OLE Objects, Graphs, Pivot Tables/Charts, and ActiveX Controls . . . . . . . . . . . . . . . . 603

Understanding Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603Types of objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604Using bound and unbound objects . . . . . . . . . . . . . . . . . . . 604Linking and embedding . . . . . . . . . . . . . . . . . . . . . . . . . . 605

Embedding Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607Embedding an unbound object . . . . . . . . . . . . . . . . . . . . . . 607Embedding bound objects . . . . . . . . . . . . . . . . . . . . . . . . 611Adding a bound OLE object . . . . . . . . . . . . . . . . . . . . . . . . 612Adding a picture to a bound object frame . . . . . . . . . . . . . . . 613Editing an embedded object . . . . . . . . . . . . . . . . . . . . . . . 613

Linking Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614Linking a bound object . . . . . . . . . . . . . . . . . . . . . . . . . . 615

Creating a Graph or Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617The different ways to create a graph . . . . . . . . . . . . . . . . . . 617Customizing the Toolbox . . . . . . . . . . . . . . . . . . . . . . . . . 618

Embedding a Graph in a Form . . . . . . . . . . . . . . . . . . . . . . . . . . 618Assembling the data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619Adding the graph to the form . . . . . . . . . . . . . . . . . . . . . . . 619

Customizing a Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626Understanding the Graph window . . . . . . . . . . . . . . . . . . . . 627Working with attached text . . . . . . . . . . . . . . . . . . . . . . . . 628Changing the graph type . . . . . . . . . . . . . . . . . . . . . . . . . 631Changing axis labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633Changing a bar color, pattern, and shape . . . . . . . . . . . . . . . . 633Modifying gridlines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634Manipulating three-dimensional graphs . . . . . . . . . . . . . . . . . 635

Integration with Microsoft Office . . . . . . . . . . . . . . . . . . . . . . . . 638Checking the spelling of one or more fields and records . . . . . . . 638Correcting your typing automatically when entering data . . . . . . 639Using OLE automation with Office 2003 . . . . . . . . . . . . . . . . . 640Creating an Excel type PivotTable . . . . . . . . . . . . . . . . . . . . 640

539868 FM.qxd 9/11/03 10:30 PM Page xlvi

Page 13: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

xlviiContents

Creating a PivotChart . . . . . . . . . . . . . . . . . . . . . . . . . . . 646Using the Calendar ActiveX Control . . . . . . . . . . . . . . . . . . . . . . 649

Part I: Creating Desktop Applications 653

Section III: Automating Your Applications 653

Chatper 18: Understanding Visual Basic and the VBA Editor . . . . . 655Migrating from Macros to Visual Basic . . . . . . . . . . . . . . . . . . . . . 655

When to use macros and when to use Visual Basic procedures . . . 656Converting existing macros to Visual Basic . . . . . . . . . . . . . . . 657Using the Command Button Wizard to create Visual Basic code . . . 660

Creating Programs in Visual Basic for Applications . . . . . . . . . . . . . 662Understanding events and event procedures . . . . . . . . . . . . . . 663Understanding modules . . . . . . . . . . . . . . . . . . . . . . . . . . 665Creating a new module . . . . . . . . . . . . . . . . . . . . . . . . . . 667

Chapter 19: Introduction to Programming and Events . . . . . . . . 679Programming Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679

How do events trigger actions? . . . . . . . . . . . . . . . . . . . . . . 680Where to trigger event procedures . . . . . . . . . . . . . . . . . . . 681

Form Event Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681Control Event Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685

Opening a form with an event procedure . . . . . . . . . . . . . . . . 686Running an event procedure when closing a form . . . . . . . . . . . 688Using an event procedure to confirm a delete . . . . . . . . . . . . . 689

Report Event Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693Running an event procedure when a report opens . . . . . . . . . . 694

Report Section Event Procedures . . . . . . . . . . . . . . . . . . . . . . . . 695Using On Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695

Using Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697Naming variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697Declaring variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698

Working with Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . 700Understanding Visual Basic Logical Constructs . . . . . . . . . . . . . . . 703

Conditional processing . . . . . . . . . . . . . . . . . . . . . . . . . . 703Repetitive looping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707

Chapter 20: Working with Expressions and Functions . . . . . . . . 713What Are Expressions? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713

The parts of an expression . . . . . . . . . . . . . . . . . . . . . . . . 715Creating an expression . . . . . . . . . . . . . . . . . . . . . . . . . . 716Special identifier operators and expressions . . . . . . . . . . . . . . 718Special keywords and properties . . . . . . . . . . . . . . . . . . . . 721

539868 FM.qxd 9/11/03 10:30 PM Page xlvii

Page 14: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

xlviii Access 2003 Bible

What Are Functions? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722Using functions in Access . . . . . . . . . . . . . . . . . . . . . . . . . 722Types of functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723

Chapter 21: Working with SQL, Recordsets, and ADO . . . . . . . . . 737Understanding SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737

Viewing SQL statements in queries . . . . . . . . . . . . . . . . . . . 738An SQL primer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 738

Creating Programs to Update a Table . . . . . . . . . . . . . . . . . . . . . 744Updating fields in a record using ADO . . . . . . . . . . . . . . . . . . 745Updating a calculated field for a record . . . . . . . . . . . . . . . . . 748Adding a new record . . . . . . . . . . . . . . . . . . . . . . . . . . . . 752Deleting a record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 753Deleting related records in multiple tables . . . . . . . . . . . . . . . 753

Chapter 22: Automating, Searches, Filters, and Query Parameters . . . . . . . . . . . . . . . . . . . . . . 757

Adding an Unbound Combo Box to Select One or More Records . . . . . . 757Using the FindRecord Command to Locate a Record . . . . . . . . . . . . 760Using the Bookmark to Locate a Record . . . . . . . . . . . . . . . . . . . . 762Filtering a Form Using Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 764Using a Query to Filter a Form Interactively . . . . . . . . . . . . . . . . . . 766

Creating a parameter query . . . . . . . . . . . . . . . . . . . . . . . . 766Creating an interactive dialog box . . . . . . . . . . . . . . . . . . . . 767Linking the dialog box to another form . . . . . . . . . . . . . . . . . 769

Chapter 23: Calling Subprocedures and Functions . . . . . . . . . . 771Understanding the Difference Between a Subprocedure and a Function. . . 771

Understanding where to create a procedure . . . . . . . . . . . . . . 772Calling procedures and functions . . . . . . . . . . . . . . . . . . . . 772Creating a procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . 773

Creating Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775Handling passed parameters . . . . . . . . . . . . . . . . . . . . . . . 777Calling a function and passing parameters . . . . . . . . . . . . . . . 778

Creating a Function to Calculate Taxes . . . . . . . . . . . . . . . . . . . . 780

Chapter 24: Effective Debugging and Error Handling in VBA . . . . 783Testing and Debugging Your Applications . . . . . . . . . . . . . . . . . . . 784VBA Assistance: Auto Quick Info and Auto List Members . . . . . . . . . . 785

Syntax checking — The first step . . . . . . . . . . . . . . . . . . . . 786Compiling Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 787Handling Runtime Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 789Using the Immediate, Locals, and Watches Windows . . . . . . . . . . . . 791Creating a Breakpoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 792

539868 FM.qxd 9/11/03 10:30 PM Page xlviii

Page 15: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

xlixContents

Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795Types of errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795The elements of error handling . . . . . . . . . . . . . . . . . . . . . . 796VBA error statements . . . . . . . . . . . . . . . . . . . . . . . . . . . 796

Logging Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802

Chapter 25: Creating Switchboards, Command Bars, Menus, Toolbars, and Dialog Boxes . . . . . . . . . . . . 805

Switchboards and Command Buttons . . . . . . . . . . . . . . . . . . . . . 806Using a switchboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . 807Creating the basic form for a switchboard . . . . . . . . . . . . . . . 807Working with command buttons . . . . . . . . . . . . . . . . . . . . . 809Creating command buttons . . . . . . . . . . . . . . . . . . . . . . . . 811Linking a command button to a macro . . . . . . . . . . . . . . . . . 818Adding a picture to a command button . . . . . . . . . . . . . . . . . 824

Working with the Switchboard Manager . . . . . . . . . . . . . . . . . . . . 826Creating the Report Switchboard . . . . . . . . . . . . . . . . . . . . 827

Creating Custom Menu Bars, Toolbars, and Shortcut Menus . . . . . . . . 835Understanding command bars . . . . . . . . . . . . . . . . . . . . . . 836Creating custom menu bars with command bars . . . . . . . . . . . 837Changing existing menus and toolbars . . . . . . . . . . . . . . . . . 838Creating a new menu bar . . . . . . . . . . . . . . . . . . . . . . . . . 838Attaching the menu bar to a form . . . . . . . . . . . . . . . . . . . . 846Creating shortcut menus . . . . . . . . . . . . . . . . . . . . . . . . . 847Creating and using custom toolbars . . . . . . . . . . . . . . . . . . . 851Attaching the toolbar to a form . . . . . . . . . . . . . . . . . . . . . 853Adding control tips to any form control . . . . . . . . . . . . . . . . . 855Starting the switchboard automatically when you

open the database . . . . . . . . . . . . . . . . . . . . . . . . . . . 855Creating a Print Report Dialog Box Form in Visual Basic . . . . . . . . . . 857

Creating a form for printing products . . . . . . . . . . . . . . . . . . 857Creating the option group . . . . . . . . . . . . . . . . . . . . . . . . . 859Creating two text boxes on the print report form . . . . . . . . . . . 859Creating command buttons . . . . . . . . . . . . . . . . . . . . . . . . 860Creating the Print event procedures . . . . . . . . . . . . . . . . . . . 861

Chapter 26: Programming Continuous Forms, Tab Dialogs, and Command Buttons . . . . . . . . . . . . . . . . . . . 865

Working with Tab Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . 866Creating a tab control . . . . . . . . . . . . . . . . . . . . . . . . . . . 867Changing the tab control page properties . . . . . . . . . . . . . . . 870Copying controls from a Detail section to a tab control page . . . . 871

Programming Continuous Forms . . . . . . . . . . . . . . . . . . . . . . . . 872Embedding a subform in a tab control . . . . . . . . . . . . . . . . . 873Creating code to delete a record from a continuous form . . . . . . 876Creating code to reposition the record pointer between tabs . . . . 878Creating code to sort data columns using labels . . . . . . . . . . . . 879

Common Code for Common Functions . . . . . . . . . . . . . . . . . . . . . 880

539868 FM.qxd 9/11/03 10:30 PM Page xlix

Page 16: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

l Access 2003 Bible

Part II: Creating Enterprise Applications 883

Section IV: Upsizing to SQL Server and MSDE 2000 883

Chapter 27: Upsizing Data to a SQL Server Database . . . . . . . . . 885Understanding MSDE 2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 885

Comparing MSDE 2000 and Jet . . . . . . . . . . . . . . . . . . . . . . 886Choosing the right database engine . . . . . . . . . . . . . . . . . . . 886

Installing MSDE 2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 889Hardware requirements . . . . . . . . . . . . . . . . . . . . . . . . . . 889Software requirements . . . . . . . . . . . . . . . . . . . . . . . . . . 889Running the SQL Server 2000 Desktop Engine

Installation Program . . . . . . . . . . . . . . . . . . . . . . . . . . 889Customizing the installation of SQL Server 2000

Desktop Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 891Starting the SQL Server 2000 Desktop Engine . . . . . . . . . . . . . . . . . 892Using the Upsizing Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . 893

Before upsizing an application . . . . . . . . . . . . . . . . . . . . . . 894Starting the Upsizing Wizard . . . . . . . . . . . . . . . . . . . . . . . 895

Chapter 28: Working with Access Projects . . . . . . . . . . . . . . . 903Upsizing to an Access Project . . . . . . . . . . . . . . . . . . . . . . . . . . 904

Starting the Upsizing Wizard . . . . . . . . . . . . . . . . . . . . . . . 904Using the Upsizing Wizard to create a Client/Server Application . . . 906

Using Unbound Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 910Working with unbound forms . . . . . . . . . . . . . . . . . . . . . . . 911Creating an unbound form . . . . . . . . . . . . . . . . . . . . . . . . 912Displaying data on the form . . . . . . . . . . . . . . . . . . . . . . . 913Updating data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 916Finding a record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 919

Chapter 29: Working with Access Projects and SQL Server Tables and Queries . . . . . . . . . . . . . . . . . . . . . . 921

Determining a Project’s Database Name . . . . . . . . . . . . . . . . . . . . 922Working with Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 923

Working with fields in the Table Design window . . . . . . . . . . . . 923The Table Properties window . . . . . . . . . . . . . . . . . . . . . . 925

Understanding Project Queries . . . . . . . . . . . . . . . . . . . . . . . . . 933Creating views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 933Creating stored procedures . . . . . . . . . . . . . . . . . . . . . . . . 935Creating user-defined functions . . . . . . . . . . . . . . . . . . . . . 938Using triggers to automatically update data . . . . . . . . . . . . . . 942

539868 FM.qxd 9/11/03 10:30 PM Page l

Page 17: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

liContents

Part III: Creating Web Applications 945

Section V: Creating Data Access Pages and Using XML and InfoPath 945

Chapter 30: Using and Creating Access Objects for Intranets and the Internet . . . . . . . . . . . . . . . . . . . . . . . 947

Types of Web Pages That Access Can Create . . . . . . . . . . . . . . . . . 948Data access pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 948Working with dynamic and static views of Web-based data . . . . . 950

Exporting Tables, Queries, Forms, and Reports to Web Pages . . . . . . . 954Exporting an Access table to static HTML format . . . . . . . . . . . 954Exporting an Access query datasheet to static HTML format . . . . 956Exporting an Access form datasheet to static HTML format . . . . . 958Changing Page Setup properties for datasheets . . . . . . . . . . . . 961Exporting a datasheet to dynamic HTML format . . . . . . . . . . . . 961Exporting a form to dynamic HTML format . . . . . . . . . . . . . . . 963Processing an IDC/HTX file on the Web server . . . . . . . . . . . . . 964Processing ASP files on the Web server . . . . . . . . . . . . . . . . . 965Exporting a report to static HTML format . . . . . . . . . . . . . . . 966HTML template files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 968

Importing and Linking (Read-Only) HTML Tables and Lists . . . . . . . . . 971Importing an HTML table . . . . . . . . . . . . . . . . . . . . . . . . . 972Linking to an HTML table . . . . . . . . . . . . . . . . . . . . . . . . . 974

Using Hyperlinks to Connect Your Application to the Internet . . . . . . . 974Using the Hyperlink data type . . . . . . . . . . . . . . . . . . . . . . 975Adding a hyperlink to a form, report, or datasheet . . . . . . . . . . 976Creating a label using the Insert Hyperlink button . . . . . . . . . . . 978

Chapter 31: Building and Working with Data Access Pages . . . . . 981Working with the Data Access Pages . . . . . . . . . . . . . . . . . . . . . . 982

What is a data access page? . . . . . . . . . . . . . . . . . . . . . . . 982Creating a single table data access page . . . . . . . . . . . . . . . . 985Working with multiple tables and grouped pages . . . . . . . . . . . 996Changing some key properties on data access pages . . . . . . . . 1014Saving other Access objects as data access pages . . . . . . . . . . 1025

Chapter 32: XML, Access, and InfoPath . . . . . . . . . . . . . . . . 1037XML Data and Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1037Understanding XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1038

What is XML? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1040What are XML schemas? . . . . . . . . . . . . . . . . . . . . . . . . . 1041Using XSL to display XML data . . . . . . . . . . . . . . . . . . . . . 1041Using XSLT with XML data . . . . . . . . . . . . . . . . . . . . . . . . 1042

539868 FM.qxd 9/11/03 10:30 PM Page li

Page 18: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

lii Access 2003 Bible

Creating Your Own XML Documents . . . . . . . . . . . . . . . . . . . . . 1043The process of creating a simple XML document . . . . . . . . . . . 1043Deciding on the tags for an XML document . . . . . . . . . . . . . . 1044Deciding on the data for an XML document . . . . . . . . . . . . . . 1045Putting the tags and data together . . . . . . . . . . . . . . . . . . . 1046Creating a multi-table XML document . . . . . . . . . . . . . . . . . 1048

Displaying XML Documents in Internet Explorer . . . . . . . . . . . . . . 1050Exporting to XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1052

Exporting a table or query to XML . . . . . . . . . . . . . . . . . . . 1053Exporting linked tables . . . . . . . . . . . . . . . . . . . . . . . . . . 1055Exporting a form to XML . . . . . . . . . . . . . . . . . . . . . . . . . 1055Exporting a report to XML . . . . . . . . . . . . . . . . . . . . . . . . 1058

Importing XML Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1059Importing simple, single table XML data . . . . . . . . . . . . . . . . 1059Importing a single table with OLE Object

from an XML document . . . . . . . . . . . . . . . . . . . . . . . . 1061Importing multi-table XML data . . . . . . . . . . . . . . . . . . . . . 1061

InfoPath and Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1062Quick overview of InfoPath . . . . . . . . . . . . . . . . . . . . . . . 1063Creating an XML-Based InfoPath form . . . . . . . . . . . . . . . . . 1065Creating an InfoPath form attached to a database . . . . . . . . . . 1070Working with an InfoPath form . . . . . . . . . . . . . . . . . . . . . 1075Importing an InfoPath XML document into Access . . . . . . . . . . 1078

Part IV: Advanced Access Database Topics 1081

Chapter 33: Exchanging Data with Office Applications . . . . . . . 1083Using Automation to Integrate with Office . . . . . . . . . . . . . . . . . . 1084

Creating Automation references . . . . . . . . . . . . . . . . . . . . 1084Creating an instance of an Automation object . . . . . . . . . . . . 1087Getting an existing object instance . . . . . . . . . . . . . . . . . . . 1088Working with Automation objects . . . . . . . . . . . . . . . . . . . 1090Closing an instance of an Automation object . . . . . . . . . . . . . 1090

An Automation Example Using Word . . . . . . . . . . . . . . . . . . . . . 1091Creating an instance of a Word object . . . . . . . . . . . . . . . . . 1095Making the instance of Word visible . . . . . . . . . . . . . . . . . . 1095Creating a new document based on an existing template . . . . . . 1096Using Bookmarks to insert data . . . . . . . . . . . . . . . . . . . . . 1096Activating the instance of Word . . . . . . . . . . . . . . . . . . . . . 1096Moving the cursor in Word . . . . . . . . . . . . . . . . . . . . . . . 1097Closing the instance of the Word object . . . . . . . . . . . . . . . . 1097Inserting pictures by using Bookmarks . . . . . . . . . . . . . . . . 1097Using Office’s Macro Recorder . . . . . . . . . . . . . . . . . . . . . 1098

539868 FM.qxd 9/11/03 10:30 PM Page lii

Page 19: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

liiiContents

Chapter 34: Adding Security to Applications . . . . . . . . . . . . . 1101Understanding Jet Security . . . . . . . . . . . . . . . . . . . . . . . . . . . 1101

Understanding workgroup files . . . . . . . . . . . . . . . . . . . . . 1102Understanding permissions . . . . . . . . . . . . . . . . . . . . . . . 1102Understanding security limitations . . . . . . . . . . . . . . . . . . . 1103

Choosing a Security Level to Implement . . . . . . . . . . . . . . . . . . . 1104Creating a Database Password . . . . . . . . . . . . . . . . . . . . . . . . . 1104Using the /runtime Option . . . . . . . . . . . . . . . . . . . . . . . . . . . 1107Using a Database’s Startup Options . . . . . . . . . . . . . . . . . . . . . . 1110Using the Jet User-Level Security Model . . . . . . . . . . . . . . . . . . . 1111

Enabling security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1111Working with workgroups . . . . . . . . . . . . . . . . . . . . . . . . 1112Working with users . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1115Working with groups . . . . . . . . . . . . . . . . . . . . . . . . . . . 1119Securing objects by using permissions . . . . . . . . . . . . . . . . 1123

Using the Access Security Wizard . . . . . . . . . . . . . . . . . . . . . . . 1129Encrypting a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1136Decrypting a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1137Protecting Visual Basic Code . . . . . . . . . . . . . . . . . . . . . . . . . . 1137Preventing Virus Infections . . . . . . . . . . . . . . . . . . . . . . . . . . . 1139

Enabling sandbox mode . . . . . . . . . . . . . . . . . . . . . . . . . 1139

Chapter 35: Creating Help Systems . . . . . . . . . . . . . . . . . . . 1143Understanding the Windows Help Structure . . . . . . . . . . . . . . . . . 1143

The Help Viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1144The Contents tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1145The Topic pane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1146

Creating a Windows Help System . . . . . . . . . . . . . . . . . . . . . . . 1147Creating Help topics . . . . . . . . . . . . . . . . . . . . . . . . . . . 1148Creating a Help project file . . . . . . . . . . . . . . . . . . . . . . . 1149Creating a table of contents . . . . . . . . . . . . . . . . . . . . . . . 1158Creating a Help Index . . . . . . . . . . . . . . . . . . . . . . . . . . . 1162

Integrating a Help File with Your Application . . . . . . . . . . . . . . . . 1167Displaying form-level Help . . . . . . . . . . . . . . . . . . . . . . . . 1167Displaying control-level Help . . . . . . . . . . . . . . . . . . . . . . 1168Mapping a Help Context ID to a Help topic . . . . . . . . . . . . . . 1169Testing the HTMLHelp API . . . . . . . . . . . . . . . . . . . . . . . . 1172Testing Help in Access . . . . . . . . . . . . . . . . . . . . . . . . . . 1173Displaying the Table of Contents . . . . . . . . . . . . . . . . . . . . 1174

Chapter 36: Working with Advanced Select Queries and Other Query Topics . . . . . . . . . . . . . . . . . . . . . 1179

Using Calculated Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1180Calculated fields and the Expression Builder . . . . . . . . . . . . . 1182Creating complex calculated fields . . . . . . . . . . . . . . . . . . . 1185

Finding the Number of Records in a Table or Query . . . . . . . . . . . . 1187Finding the Top (n) Records in a Query . . . . . . . . . . . . . . . . . . . 1189

539868 FM.qxd 9/11/03 10:30 PM Page liii

Page 20: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

liv Access 2003 Bible

How Queries Save Field Selections . . . . . . . . . . . . . . . . . . . . . . 1191Hiding (not showing) fields . . . . . . . . . . . . . . . . . . . . . . . 1191Renaming fields in queries . . . . . . . . . . . . . . . . . . . . . . . . 1192Hiding and unhiding columns in the QBE pane . . . . . . . . . . . . 1193

Query Design Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1195Setting Query Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1197Creating Queries That Calculate Totals . . . . . . . . . . . . . . . . . . . . 1199

Showing and hiding the Total: row in the QBE pane . . . . . . . . . 1200The Total: row options . . . . . . . . . . . . . . . . . . . . . . . . . . 1201Performing totals on all records . . . . . . . . . . . . . . . . . . . . 1205Performing totals on groups of records . . . . . . . . . . . . . . . . 1206Specifying criteria for a total query . . . . . . . . . . . . . . . . . . 1210Creating expressions for totals . . . . . . . . . . . . . . . . . . . . . 1213

Creating Crosstab Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . 1216Understanding the crosstab query . . . . . . . . . . . . . . . . . . . 1216Creating the crosstab query . . . . . . . . . . . . . . . . . . . . . . . 1217Entering multiple-field row headings . . . . . . . . . . . . . . . . . . 1219Specifying criteria for a crosstab query . . . . . . . . . . . . . . . . 1221Specifying fixed column headings . . . . . . . . . . . . . . . . . . . 1224The Crosstab Query Wizard . . . . . . . . . . . . . . . . . . . . . . . 1226

Chapter 37: Working with Action and SQL Queries . . . . . . . . . 1229About Action Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1229

Types of action queries . . . . . . . . . . . . . . . . . . . . . . . . . 1230Uses of action queries . . . . . . . . . . . . . . . . . . . . . . . . . . 1230The process of action queries . . . . . . . . . . . . . . . . . . . . . . 1231Viewing the results of an action query . . . . . . . . . . . . . . . . . 1231Reversing action queries . . . . . . . . . . . . . . . . . . . . . . . . . 1232

Creating Action Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1233Creating an update action query to change values . . . . . . . . . . 1233Creating a new table using a make-table query . . . . . . . . . . . . 1238Creating queries to append records . . . . . . . . . . . . . . . . . . 1242Creating a query to delete records . . . . . . . . . . . . . . . . . . . 1250Creating other queries using the Query Wizards . . . . . . . . . . . 1255Saving an action query . . . . . . . . . . . . . . . . . . . . . . . . . . 1258Running an action query . . . . . . . . . . . . . . . . . . . . . . . . . 1258

Troubleshooting Action Queries . . . . . . . . . . . . . . . . . . . . . . . . 1259Data-type errors in appending and updating . . . . . . . . . . . . . 1259Key violations in action queries . . . . . . . . . . . . . . . . . . . . . 1259Record-locked fields in multi-user environments . . . . . . . . . . . 1259Text fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1259

SQL-Specific Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1260Creating union queries . . . . . . . . . . . . . . . . . . . . . . . . . . 1260Creating pass-through queries . . . . . . . . . . . . . . . . . . . . . 1261Creating data definition queries . . . . . . . . . . . . . . . . . . . . 1262Creating SQL subqueries in an Access query . . . . . . . . . . . . . 1263

539868 FM.qxd 9/11/03 10:30 PM Page liv

Page 21: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

lvContents

Chapter 38: Increasing the Speed of an Application . . . . . . . . . 1265Understanding Module Load on Demand . . . . . . . . . . . . . . . . . . . 1265

Organizing your modules . . . . . . . . . . . . . . . . . . . . . . . . 1266Access 2003 prunes the call tree . . . . . . . . . . . . . . . . . . . . 1266

Using the Access 2002-2003 Database File Format . . . . . . . . . . . . . 1268Distributing .MDE Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1270Understanding the Compiled State . . . . . . . . . . . . . . . . . . . . . . 1272

Putting your application’s code into a compiled state . . . . . . . . 1273Losing the compiled state . . . . . . . . . . . . . . . . . . . . . . . . 1274Distributing applications in a compiled or uncompiled state . . . . 1275

Improving Absolute Speed . . . . . . . . . . . . . . . . . . . . . . . . . . . 1279Tuning your system . . . . . . . . . . . . . . . . . . . . . . . . . . . 1281Getting the most from your tables . . . . . . . . . . . . . . . . . . . 1281Getting the most from your queries . . . . . . . . . . . . . . . . . . 1284Getting the most from your forms and reports . . . . . . . . . . . . 1285Getting the most from your modules . . . . . . . . . . . . . . . . . . 1288Increasing Network Performance . . . . . . . . . . . . . . . . . . . . 1293

Improving Perceived Speed . . . . . . . . . . . . . . . . . . . . . . . . . . 1293Using a splash screen . . . . . . . . . . . . . . . . . . . . . . . . . . 1293Loading and keeping forms hidden . . . . . . . . . . . . . . . . . . . 1294Using the hourglass . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1295Using the built-in progress meter . . . . . . . . . . . . . . . . . . . . 1295Creating a progress meter with a pop-up form . . . . . . . . . . . . 1297Speeding up the progress meter display . . . . . . . . . . . . . . . . 1299

Working with Large Program Databases in Access 2003 . . . . . . . . . . 1300How databases grow in size . . . . . . . . . . . . . . . . . . . . . . . 1300Simply compiling and compacting may not be enough . . . . . . . 1301Rebooting gives you a clean memory map . . . . . . . . . . . . . . 1302Repair does nothing if the database is not corrupt . . . . . . . . . . 1302You can fix a single corrupt form by removing

the record source . . . . . . . . . . . . . . . . . . . . . . . . . . . 1302Create a new database and import all of the objects . . . . . . . . . 1302The decompile option in Access 2003 . . . . . . . . . . . . . . . . . 1303Summary — six steps to large database success . . . . . . . . . . . 1304An interface for detecting an uncompiled database

and automatically recompiling . . . . . . . . . . . . . . . . . . . . 1305Making small changes to large databases — export . . . . . . . . . 1307

Chapter 39: Preparing Your Application for Distribution . . . . . . 1309Defining the Startup Parameters of the Application . . . . . . . . . . . . 1310

Application Title . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1310Application Icon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1310Menu Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1311Allow Full Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1311Allow Default Shortcut Menus . . . . . . . . . . . . . . . . . . . . . . 1311Display Form/Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1311Display Database Window . . . . . . . . . . . . . . . . . . . . . . . . 1311

539868 FM.qxd 9/11/03 10:30 PM Page lv

Page 22: Access 2003 Bible Table of Contents - Wiley€¦ · xxxvi Access 2003 Bible Creating a New Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 The table design

lvi Access 2003 Bible

Display Status Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1311Shortcut Menu Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1312Allow Built-in Toolbars . . . . . . . . . . . . . . . . . . . . . . . . . . 1312Allow Toolbar/Menu Changes . . . . . . . . . . . . . . . . . . . . . . 1312Use Access Special Keys . . . . . . . . . . . . . . . . . . . . . . . . . 1312Testing the application before distribution . . . . . . . . . . . . . . 1313

Polishing Your Application . . . . . . . . . . . . . . . . . . . . . . . . . . . 1314Giving your application a consistent look and feel . . . . . . . . . . 1314Adding common professional components . . . . . . . . . . . . . . 1316Creating comprehensive and intuitive menus

and toolbars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1319Bulletproofing an Application . . . . . . . . . . . . . . . . . . . . . . . . . 1319

Using error trapping on all Visual Basic procedures . . . . . . . . . 1319Separating the code objects from the tables

in the application . . . . . . . . . . . . . . . . . . . . . . . . . . . 1320Documenting the application . . . . . . . . . . . . . . . . . . . . . . 1320Creating a help system . . . . . . . . . . . . . . . . . . . . . . . . . . 1321Implementing a security structure . . . . . . . . . . . . . . . . . . . 1321

The Access 2003 Developer Extensions . . . . . . . . . . . . . . . . . . . 1321Using the Package Wizard . . . . . . . . . . . . . . . . . . . . . . . . 1322Working with the Property Scanner Add-In . . . . . . . . . . . . . . 1330

Part V: Appendixes and Reference Material 1331

Appendix A: Access 2003 Specifications . . . . . . . . . . . . . . . . 1333

Appendix B: Access Auto Auction Tables . . . . . . . . . . . . . . . 1339

Appendix C: Using the CD-ROM Included with the Book . . . . . . 1345

Appendix D: Using Standard Naming Conventions . . . . . . . . . 1355

Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1363

539868 FM.qxd 9/11/03 10:30 PM Page lvi