Skip to main content

Access 2003 VBA Programmer's Reference

Access 2003 VBA Programmer's Reference

Patricia Cardoza, Teresa Hennig, Graham Seach, Armen Stein

ISBN: 978-0-764-55903-7

Apr 2004

984 pages

Select type: Paperback

Product not available for purchase


What is this book about?

Its power and short learning curve have made Access Microsoft’s leading consumer relational database management system for desktop applications. VBA lets you tap more of that power, responding to application level events, displaying forms and reports, manipulating toolbars, and much more.

In this book, a crack team of programmers, including two Microsoft MVPs, shows you how to take control of Access 2003 or 2002 using VBA. You’ll learn to create and name variables, use DAO and ADO to manipulate data, handle errors correctly, create classes and use APIs, and more. An entire chapter is devoted to the changes in Access 2003, including new wizards and GUI features that previously required VBA code as well as new VBA features.

You’ll receive a thorough education in system security, macro security, and the Access Developer Extensions (ADE). You will discover how to access data with VBA, execute and debug VBA code, and use VBA with Access objects. Finally, you will learn more about the relationship between Access and SQL Server, and how to use VBA in Access to control and enhance other Office applications.

What does this book cover?

Here are some of the things you'll discover in this book:

  • How to take advantage of the built-in Access object library, using Access commands and executing them from any Access toolbar
  • What you need to know to design your own classes, implement common APIs in your code, and use SQL to access data
  • How to configure custom menus for your Access database applications
  • Ways to transfer information between Access and Excel, Word, Outlook, and other Office programs
  • How to show or hide entire sections of reports based on data entered on a form, or hide form fields based on database login information
  • Object models you can use when writing VBA code in Access, and a list of common API functions to use in your code

Who is this book for?

This book is a comprehensive resource for Access users and VBA developers who want to increase the power of Access using VBA. In addition to experience with VBA, you should have read at least one tutorial covering VBA for Access.


Title Page.

Copyright Page.



Author Bios.


1. Intro to Access.

2. Access, VBA, and Macros.

3. New Features in 2003 (and 2002).

4. VBA Basics.

5. Using the VBA Editor.

6. Using DAO to Access Data.

7. Using ADO to Access Data.

8. Executing VBA.

9. VBA Error Handling.

10. Using VBA to Enhance Forms.

11. Enhancing Reports with VBA.

12. Creating Classes.

13. APIs.

14. SQL & VBA.

15. Working with Office Applications.

16. Security.

17. Understanding Client-Server Development with VBA.

18. Windows Registry.

19. Using the ADE Tools.

20. Macro Security.

Appendix A:  Upgrading to Access 2003.

Appendix B: References for Projects.

Appendix C: DAO Object Method and Property Descriptions.

Appendix D: ADO Object Model Reference.

Appendix E: Access Object Model.

Appendix F: Windows API Reference Information .

Appendix G: Naming Conventions.

Appendix H: VBA Reserved Words.

Appendix I: Tips and Tricks.

Appendix J: ADO Object Argument Information.

Appendix K: Access Wizards, Builders and Managers.

Appendix L: Windows Registry Information.


Download the code and example databases for the book in .zip format.
Code Downloads
Code downloads for this title are available here.
Download the code and example databases for the book in .zip format.
Code Downloads
Code downloads for this title are available here.
Download the code and example databases for the book in .ace format only 3/4 the size of the .zip.
Go to if your archive software doesn't support the .ace format.
ChapterPageDetailsDatePrint Run
87Replacement Code
At the bottom of page, last 2 sentences: should be: The following code sample illustrates how both the declaration and it’s location affect a variable’s scope and lifetime.
Option Explicit 'Used to require variable declaration

Public txtCustomerName as String 'Scope is entire application
Private txtVendor as String 'Scope is any procedure in this module
Dim txtSupplier as String 'Scope is the current module

Private Sub GetCustomerName()
Dim txtCustomer as String 'Scope is limited to this sub
End Sub
You might be wondering why the two statements that begin with Dim have different scopes. Use of the Dim keyword in the General Declarations section sets the scope of the variable to the module, so it can be used by any procedure in that module.. In the previous listing, txtVendor and txtSupplier are both module-level variables. They can be used anywhere within the module and anytime the module is loaded. txtCustomerName is a global variable. It can be used anywhere within any procedure in the application.