You are previewing Access 2003 VBA Programmer's Reference.
O'Reilly logo
Access 2003 VBA Programmer's Reference

Book Description

  • Covers all features of VBA programming for Access database applications

  • Begins with an overview of VBA and highlights what's new in Microsoft Access 2003, the most popular database system in the world

  • Real-world code examples demonstrate each programming topic, including using the Access Object Model, VBA execution and error handling, creating database objects with VBA, writing secure VBA code, and much more

  • Shows how Access 2003 provides enhanced XML support, making it easier for programmers to publish data to the Web and exchange it with other organizations

Table of Contents

  1. Copyright
  2. Dedication
  3. Credits
  4. About the Authors
  5. Contributors
  6. Acknowledgments
  7. Foreword
  8. Introduction
  9. Introduction to Microsoft Access
    1. Why Use Microsoft Access?
    2. Is Access the Only Database I'll Ever Need?
    3. Automating Microsoft Access Without VBA Code
    4. Creating a Switchboard for Your Database
    5. Add and Configure Controls Using Wizards
    6. Building Automation into Your Project
    7. Summary
  10. Access, VBA, and Macros
    1. VBA within Access
    2. VBA versus Macros in Access
    3. Summary
  11. New Features in Access 2003(and 2002)
    1. Easy Upgrading
    2. Database Structure and Management Tools for Developers
    3. New Wizards and Builders and Managers
    4. Changes to Jet
    5. Security and Related Features
    6. End-User Enhancements
    7. XML and Access
    8. Using Access 2003 with SharePoint Services
    9. Access Developer Extensions
    10. Summary
  12. VBA Basics
    1. VBA Objects
    2. Variables and VBA Syntax
    3. Other VBA Structures
    4. Summary
  13. Using the VBA Editor
    1. Anatomy of the VBA Editor
    2. Your Access Database and VBA Project—Better Together
    3. Summary
  14. Using DAO to Access Data
    1. Direct Access Objects
    2. Why Use DAO?
    3. Referring to DAO Objects
    4. The DBEngine Object
    5. The Databases Collection
    6. The Connections Collection
    7. DAO Object Properties
    8. Creating Schema Objects with DAO
    9. Managing Jet Security with DAO
    10. Data Access with DAO
    11. Summary
  15. Using ADO to Access Data
    1. Ambiguous References
    2. Referring to ADO Objects
    3. Connecting to a Data Source
    4. Data Access with ADO
    5. Creating ADO Recordsets
    6. Creating Schema Recordsets
    7. Using ADO Events
    8. Creating Schema Objects with ADOX
    9. Managing Jet Security with ADO
    10. Summary
  16. Executing VBA
    1. When Events Fire
    2. VBA Procedures
    3. Using Variables
    4. Evaluating Expressions in VBA
    5. Using Recordsets
    6. Using VBA in Forms and Reports
    7. Debugging VBA
    8. Summary
  17. VBA Error Handling
    1. Why Use Error Handling?
    2. Two Kinds of Errors: Unexpected and Expected
    3. Basic Error Handling
    4. Basic Error Handling with a Twist
    5. Cleaning Up After an Error
    6. More on Absorbing an Expected Error: Example
    7. Error Handling with Logging
    8. Error Handling That Sends E-mail
    9. Summary
  18. Using VBA to Enhance Forms
    1. Concept Review
    2. Properties
    3. Event Property and Procedure Examples
    4. When Not to Use VBA
    5. Summary
  19. Enhancing Reports with VBA
    1. Event Properties
    2. You Talking to Me?
    3. Event Property and Procedure Examples
    4. When Not to Use VBA
    5. Summary
  20. Creating Classes in VBA
    1. A Touch of Class
    2. Why Use Classes?
    3. Creating a Class Module
    4. Naming Objects
    5. Summary
  21. Extending VBA with APIs
    1. Introducing the Win32 API
    2. Introducing DLLs
    3. Linking Libraries in Access 2003
    4. Understanding C Parameters
    5. Err.LastDLLError
    6. Distributing Applications That Reference Type Libraries and Custom DLLs
    7. Summary
  22. SQL and VBA
    1. Working with SQL Strings in VBA
    2. Using SQL When Opening Forms and Reports
    3. Using SQL to Enhance Forms
    4. The ReplaceOrderByClause and ReplaceWhereClause Functions
    5. Summary
  23. Working with Office Applications
    1. Sharing Information Is a Two-Way Street
    2. Access and Outlook—Sharing Data with Others
    3. Sending Information from Access to Excel
    4. Exchanging Information with Microsoft Word
    5. An Advanced Example—Creating a Graph in Access and Inserting It into PowerPoint
    6. Using the Access Object Model to Pull Data from Access to Other Applications
    7. Summary
  24. Database Security
    1. Access Security Model Overview
    2. Shared-Level Security
    3. Encoding a Database
    4. Secure VBA Code
    5. User-Level Security
    6. Summary
  25. Understanding Client/Server Development with VBA
    1. ADP Versus MDB: Choosing the Right Client Format
    2. Controlling the Logon Process
    3. Binding Recordsets to Objects
    4. Using Unbound Forms
    5. Summary
  26. Working with the Win32 Registry
    1. About the Registry
    2. Using the Built-In VBA Registry Functions
    3. Using the Win32 Registry APIs
    4. Putting It All together
    5. Summary
  27. Using the ADE Tools
    1. Redistributable Access Runtime
    2. Property Scanner
    3. Custom Startup Wizard
    4. Package Wizard
    5. Summary
  28. Macro Security
    1. Macro Security
    2. Digital Signatures and Certificates
    3. Microsoft Jet Expression Services and Sandboxes
    4. Summary
  29. Appendices
    1. Upgrading to Access 2003
      1. To Convert or To Enable—The Age-Old Question
      2. Key Decision Factors
      3. Converting to Access 2003
      4. Converting a Secured Database
      5. Converting a Replicated Database
      6. Enabling a Database
      7. Converting from Access 2003 to Prior Versions
    2. References for Projects
      1. Types of References
      2. Adding References to Your Projects
      3. Building Code Libraries
      4. Resources
    3. DAO Object Method and Property Descriptions
      1. Diagrams
      2. DAO-Supported Objects
      3. Undocumented Tools and Resources
      4. OpenRecordset Constants
    4. ADO Object Model Reference
      1. The Connection Object
      2. The Errors Collection and Error Object
      3. The Properties Collection and Property Object
      4. The Command Object
      5. The Parameters Collection
      6. The Recordset Object
      7. The Fields Collection
      8. The Field Object
      9. Record Object
      10. The Stream Object
    5. The Access Object Model
      1. The Application Object
      2. The CodeData Object
      3. AllDatabaseDiagrams Collection
      4. AccessObject
      5. The AllFunctions Collection
      6. Other Similar Collections
      7. The CurrentData Object
      8. The CodeProject Object
      9. The CurrentProject Object
      10. The DataAccessPages Collection
      11. The DataAccessPage Object
      12. The DefaultWebOptions Object
      13. The DoCmd Object
      14. The Forms Collection
      15. The Control Object
      16. The Module Object
      17. The Section Object
      18. The Printer Object
      19. The References Collection and Reference Object
      20. The Reports Collection and Report Object
      21. The Screen Object
      22. The SmartTag Object
      23. The SubForm Object
      24. The SubReport Object
      25. Other Helpful Information
    6. Windows API Reference Information
      1. API Viewer
      2. Web Sites
      3. Books
      4. Some Useful API Functions
    7. Naming Conventions
      1. Why Implement Naming Conventions?
      2. A Brief History
      3. The Fundamentals of the Hungarian Convention
      4. Rules for Creating Names—Adding the Personal Touch
      5. More Do's and Don'ts
      6. Tables
    8. Reserved Words and Special Characters
      1. What Are the Sources of Reserved Words?
      2. Reserved Words
      3. What Are Special Characters?
    9. Tips and Tricks
      1. Visual Interface Standards
      2. Find Records
      3. Split Your Application
      4. Display Informative Form Captions
      5. Preload Records
      6. Use a Splash Screen
      7. Determine the User Name
    10. ADO Object Argument Information
      1. Connection.Execute Method Options
      2. Recordset.Open Method Options
      3. Connection.OpenSchema Method Options
      4. Group or User.SetPermissions Method Options
    11. Access Wizards, Builders, and Managers
      1. Access Wizards
      2. Access Builders
      3. Access Managers
    12. Windows Registry Information
      1. Windows Registry Data Types
      2. Registry Function Declarations
      3. Registry API Constant and User-Defined Type Declarations
  30. Index