| Introduction | 1 |
| Who is This Book For? | 1 |
| What's Covered in This Book | 2 |
| What's Not Covered in This Book | 2 |
| What You Need To Use This Book | 2 |
| The CD-ROM | 3 |
| The Ice Cream Shop | 3 |
| Conventions | 3 |
| Tell Us What You Think | 4 |
| Chapter 1 | Access 2000--A Long Journey | 7 |
| The Book Structure | 7 |
| Access 2000 | 8 |
| Data Stores | 8 |
| Access Projects | 9 |
| Data Access Pages | 9 |
| Name Auto-Correct | 10 |
| Sub Datasheets | 10 |
| Programmability | 10 |
| JET 4.0 | 10 |
| The Future | 11 |
| Summary | 12 |
| Chapter 2 | Designing Applications | 15 |
| What Is An Access Application? | 15 |
| The Development Process | 16 |
| The Analysis Phase | 17 |
| Design and Coding | 20 |
| Testing | 22 |
| Documentation | 23 |
| Acceptance | 23 |
| Review | 23 |
| The Ice Cream Shop Application | 24 |
| Designing the Ice Cream Shop Database | 25 |
| Choosing a Storage Engine | 29 |
| Entering and Viewing Data | 29 |
| Macros Or VBA? | 39 |
| Why You Should Use VBA | 39 |
| When to Use Macros | 40 |
| Summary | 43 |
| Exercises | 43 |
| Chapter 3 | Introduction to Event Driven Programming | 45 |
| Examples of Events | 46 |
| How Windows Handles Events | 47 |
| So Many Events... | 51 |
| Handling Events in Access with VBA | 53 |
| The VBA IDE | 66 |
| Components of the VBA IDE | 67 |
| Converting Macros to VBA | 73 |
| Completing the Company Contacts Form | 76 |
| Summary | 79 |
| Exercises | 79 |
| Chapter 4 | Creating Code | 81 |
| Procedures | 81 |
| Modules | 83 |
| Subroutines and Functions | 83 |
| Procedure Declaration | 84 |
| Function Types | 85 |
| Parameters or Arguments | 88 |
| Optional Arguments | 90 |
| Default Values | 91 |
| Named Arguments | 92 |
| Built-In Functions | 93 |
| Variables | 93 |
| Declaring Variables | 94 |
| Manipulating Variables | 95 |
| Variable Types | 96 |
| Constants | 113 |
| Intrinsic Constants | 113 |
| Variable Scope and Lifetime | 115 |
| Local Variables | 115 |
| Static Variables | 118 |
| Global Variables | 119 |
| Public Variables | 121 |
| Naming Conventions | 121 |
| Naming Conventions for Controls | 123 |
| Naming Conventions for Objects | 124 |
| Naming Conventions for Constants | 125 |
| Naming Conventions Summary | 125 |
| Summary | 125 |
| Exercises | 126 |
| Chapter 5 | Controlling the Program | 129 |
| Programming Structures | 129 |
| Expressions | 129 |
| Selection Structures | 130 |
| If...Then... | 130 |
| If...Then...Else... | 131 |
| ElseIf... | 132 |
| Logical Operators with the If statement | 133 |
| Select Case | 133 |
| IIf | 138 |
| Operator Precedence | 139 |
| Repetition | 141 |
| Loops | 141 |
| Nested Control Structures | 143 |
| Exiting a Control Structure | 144 |
| Arrays | 144 |
| Static Arrays | 148 |
| Dynamic Arrays | 149 |
| Summary | 154 |
| Exercises | 154 |
| Chapter 6 | Using Access Objects | 157 |
| Object-Oriented Programming | 157 |
| Objects | 158 |
| The Advantages of Object-Orientation | 159 |
| Object Models | 159 |
| Using Object Models in VBA | 160 |
| Access 2000 Objects | 161 |
| The AccessObject Object | 163 |
| Dynamic List Boxes | 165 |
| Forms and Reports | 176 |
| Control Types | 179 |
| The Err Object | 180 |
| Referring to Objects | 181 |
| Special Objects | 182 |
| The Me Property | 184 |
| The Object Browser | 185 |
| Summary | 187 |
| Exercises | 187 |
| Chapter 7 | Using DAO | 189 |
| DAO vs ADO | 189 |
| A Brief History Of DAO | 190 |
| The Future of DAO | 191 |
| The DAO Hierarchy | 194 |
| The DBEngine Object | 197 |
| The Workspace Object | 197 |
| The Database Object | 198 |
| The TableDefs Collection | 200 |
| The QueryDefs Collection | 201 |
| The Recordsets Collection | 201 |
| Building Recordsets Dynamically | 207 |
| Requerying Data in Recordsets | 208 |
| Working with Recordsets | 208 |
| Examining Field Values | 212 |
| Moving Through Recordsets | 212 |
| Counting Records in a Recordset | 219 |
| Looking for Specific Records | 222 |
| Bookmarks | 232 |
| Editing Records in Recordsets | 234 |
| Summary | 238 |
| Exercises | 238 |
| Chapter 8 | Data Management Techniques | 241 |
| The Challenge--Flexibility vs. Manageability | 241 |
| The Requirement--Ad Hoc Query Functionality | 242 |
| Why Not Use Parameterised Queries? | 244 |
| Building a Query by Form Interface | 246 |
| Creating and Modifying QueryDefs | 252 |
| Working with SQL | 256 |
| Two Approaches to Displaying Results | 263 |
| Modifying the QueryDef | 266 |
| Using a Matching Records table | 270 |
| Building Tables | 279 |
| Summary | 285 |
| Exercises | 286 |
| Chapter 9 | External Data | 291 |
| Other Applications | 291 |
| Databases | 292 |
| Spreadsheets | 296 |
| Text Files | 296 |
| Specifications | 301 |
| Electronic Mail | 306 |
| Using External Data | 309 |
| The Database Splitter | 310 |
| Linked Tables | 311 |
| Summary | 313 |
| Exercises | 313 |
| Chapter 10 | Reports | 315 |
| Starting Off | 315 |
| Page Numbers | 320 |
| IIf | 320 |
| Dates | 322 |
| Summarizing | 323 |
| Expressions | 324 |
| Events | 325 |
| Open | 325 |
| Activate | 326 |
| Deactivate | 326 |
| Close | 327 |
| Error | 327 |
| Format | 328 |
| Print | 332 |
| Retreat | 333 |
| NoData | 333 |
| Page | 333 |
| When To Use the Different Events | 334 |
| Filters | 334 |
| Summary | 340 |
| Exercise | 340 |
| Chapter 11 | Advanced Programming Techniques | 343 |
| Arrays | 343 |
| Multi-dimensional Arrays | 344 |
| Memory Considerations | 346 |
| Parameter Arrays | 347 |
| The Array Function | 349 |
| The GetRows Method | 350 |
| Detecting Arrays | 352 |
| Arguments | 358 |
| Passing Arguments By Value | 358 |
| Dynamic-Link Libraries (DLLs) | 361 |
| Declaring a DLL in Code | 361 |
| Custom DAO Properties | 373 |
| Summary | 380 |
| Exercises | 380 |
| Chapter 12 | Error Handling and Debugging | 383 |
| Planning for Errors | 383 |
| The Design | 384 |
| Object Oriented Techniques | 386 |
| Option Explicit | 386 |
| Syntax Checking | 386 |
| Comments | 387 |
| Compiling | 388 |
| Testing | 388 |
| Types of Errors | 390 |
| Syntax Errors | 390 |
| Compile Errors | 391 |
| Run-Time Errors | 392 |
| Semantic Errors | 392 |
| Locating Errors | 396 |
| Other Errors | 397 |
| Debugging | 398 |
| Program Execution | 398 |
| Changing Code | 403 |
| The Call Stack | 404 |
| The Immediate Window | 405 |
| The Locals Window | 406 |
| The Watch Window | 406 |
| Instant Watches | 406 |
| Hovering | 407 |
| Error Handling | 415 |
| The Err Object | 416 |
| Visual Basic Errors | 416 |
| Form Errors | 421 |
| Access and VBA Errors | 423 |
| Data Access Errors | 423 |
| User Defined Errors | 426 |
| The Error Stack | 428 |
| Debugging your Debugging Code | 431 |
| Summary | 431 |
| Exercises | 432 |
| Chapter 13 | Using Classes | 435 |
| Class Modules and Custom Objects | 435 |
| What Are Objects? | 436 |
| Why Use Objects? | 437 |
| The My Rectangle Class | 439 |
| The PaymentStats Class | 458 |
| Class Events | 474 |
| Forms as Class Modules | 476 |
| Creating Custom Properties for Forms | 477 |
| Custom Form Methods | 480 |
| Creating Multiple Instances of Objects | 480 |
| Collections--Creating a Hierarchy | 484 |
| Getting the Most from Class Modules | 484 |
| Hide Your Data | 484 |
| Don't Overdo It | 485 |
| Avoid Get and Set Methods | 485 |
| Get the Object Model Right | 485 |
| Make it Look Easy | 486 |
| Summary | 486 |
| Exercises | 486 |
| Chapter 14 | Libraries and Add-Ins | 489 |
| Library Databases | 489 |
| Creating a Library Database | 490 |
| Considerations | 497 |
| Class Libraries | 498 |
| An ADO Class Library | 498 |
| Add-Ins | 504 |
| The Language Converter Add-In | 504 |
| The Color Schemes Add-In | 523 |
| Creating Add-Ins Summary | 523 |
| Updating your Add-In | 524 |
| Summary | 525 |
| Exercises | 525 |
| Chapter 15 | Automation | 527 |
| What Is Automation? | 527 |
| Interfaces and Object Models | 528 |
| Object References | 529 |
| Creating Automation Objects | 530 |
| Microsoft Outlook | 530 |
| Microsoft Word | 540 |
| Word Summary | 548 |
| Microsoft Excel | 549 |
| Graph Summary | 559 |
| Office Assistant | 559 |
| Summary | 560 |
| Exercises | 560 |
| Chapter 16 | Multi-User | 563 |
| Multi-Developer Issues | 563 |
| Record Locking in Access 2000 | 564 |
| Implementing Record Locking on Forms | 572 |
| Recordsets and Record Locking | 572 |
| Handling Record Locking Errors | 575 |
| Security | 580 |
| Why Security? | 580 |
| Setting a Database Password from VBA | 582 |
| Protecting Your Code | 582 |
| The Access Security Model | 583 |
| Manipulating Users and Groups | |