Synopses & Reviews
Access 2007 VBA Programmer's Reference
covers a wide spectrum of programming topics relevant to Access. Although it assumes the reader has some familiarity with VBA programming language, it begins with a brief introduction to VBA. And to help you leverage the tools that Access provides, a chapter highlights the new features in Microsoft Office Access 2007 — including new wizards and GUI (graphical user interface) elements that previously required VBA code, as well as new VBA features.
The book also discusses how to create and name variables, how to use Data Access Object (DAO) and ActiveX Data Object (ADO) to manipulate data both within Access and within other applications, proper error handling techniques, and advanced functions such as creating classes and using APIs. Key new objects such as using Macros and the Ribbon are explored, too, as are forms and reports, the two most powerful tools for working with and displaying data. Working with other applications is covered extensively both in a general nature and for working specifically with Microsoft Office applications, Windows SharePoint Services, and SQL Server. Of course, this book wouldn’t be complete without discussing security issues and the Developer Extensions.
Chapters 1–5 provide material that you need if you're new to Access or VBA. After a review of Access 2007's new features, you explore the building blocks of VBA, including objects, properties, methods, and events. And you're introduced to the VBA Editor and its various debugging tools.
Chapters 6 and 7 focus on using VBA to access data. Both DAO and ADO provide methods for accessing data in Microsoft Access and other external data sources such as Informix, SQL Server, and a variety of accounting programs.
Chapters 8 and 9 provide detailed information on executing and debugging VBA code. Every development project needs some debugging, even if you're an expert developer. You'll see some easy ways to debug your code, and get some tips and tricks to make the tedious process of debugging a bit easier. Error handling is for more than just trapping problems and preventing crashes. It provides a powerful tool for interacting with users and adding functionality to programs.
Chapters 10 and 11 tackle forms and reports, two Access objects that can make particularly heavy use of VBA. In many applications, forms and reports control what the user can see and do. With the advent of report browsers, nearly all of the events that were available on forms are now accessible on reports. So, in addition to using code to show or hide sections of reports and to provide special formatting, you can now drill into the data underlying the report. These two chapters are packed with information; you'll see how to use split screens on forms, create professional image controls, format reports based on cross tab queries, enhance interactive reports, alternate row colors, and much more.
Advanced VBA programming information begins in the next four chapters (12–15) — creating classes in VBA, using APIs, and using SQL and VBA. Because the Office Ribbon is new, there is a chapter dedicated to explaining how to customize and work with the ribbon.
Chapters 16–22 provide information about working with other programs, working with Windows, and controlling access to your applications and files. They also discuss some techniques for deploying database solutions. You’ll learn to create tasks and e-mail in Outlook, perform a mail merge in Word, export data to an Excel spreadsheet, and take information from Access, create a graph, and insert that graph into PowerPoint. Windows SharePoint services can help your applications share data across the Web. You’ll see how new file formats add to network and Access security. In addition, you'll work with client/server development, learn to take advantage of Windows Registry and explore the Access Developer Extensions, essentially a Microsoft add-in, before you tackle macro security.
As a developer, you can often spend hours going from source to source looking for reference material. The authors have applied the principles of relational databases (doing the work once so it can be used many times in multiple ways) to the appendixes, providing a compilation of data from a myriad of sources.
Appendix A addresses the issues and processes of upgrading, converting, and compatibility. The other 12 appendixes provide lists and tables that complement specific chapters in the book. You'll find detailed lists of objects for both DAO and ADO as well as the Access object model and Windows Registry. The appendixes on naming conventions and reserved words provide invaluable information that not only can strengthen your programming style but can save you from using terms or characters that can cause hours of needless pain and frustration in debugging and correcting. The last appendix is filled with tips and tricks to make it easier and faster for you to develop professional applications, all solicited from MVPs and developers around the world.
The initial chapters are written in a tutorial format with detailed examples. True to the Wrox Programmer's Reference standard format, the book includes numerous reference appendixes with details on the various object models you might use when writing VBA code in Access. It also provides a detailed primer on the Windows Registry and a listing of common API functions you might want to use in your code.
Real-world examples are given for many, if not most, of the programming topics covered in this book. These are just of few of the topics and examples that are included:
- How to control access to data based on database login information.
- How to create custom reports based on information entered on a form.
- How to leverage report browse — the new interactive report feature that enables drilling into data on reports.
- How to summarize and graphically display data using cross-tab reports.
- How to use VBA to transfer data between Access and other Office programs such as Outlook, Word, and Excel.
- How to configure custom ribbons, toolbars, and menus for your Access database applications.
- How to use the image controls for more intuitive and professional looking forms.
Providing complete and authoritative coverage of all aspects of VBA programming for Access applications, this book uses real-world code examples to demonstrate each programming topicIntroductory chapters provide a brief overview of VBA and highlight what's new in Access 2007, the most popular database system in the worldShows experienced VBA developers and programmers how to create secure VBA code and examines how to use VBA with ADO, SQL, APIs, or other Office applicationsDemonstrates how to use the Access object model, the Windows registry, and ADE tools, and explains how to use VBA to create and enhance forms and reportsThe companion Web site includes updates to the book and links to useful resources
This resource provides the tools you need to leverage Access 2007’s built-in functionality and VBA in order to build more dynamic applications. The author team explores all aspects of VBA programming for Access, describes the latest innovations, and explains how to take advantage of key new objects, enhanced macros, and the Office Ribbon. Plus, you’ll find several commonly used techniques and sample code to help you get started, as well as expert tips to make your code easier to maintain.
Access 2007 VBA Programmer's Reference
Written by Access MVPs and Microsoft Access testers, this resource will give you the tools to leverage Access 2007's built-in functionality and VBA in order to build more dynamic applications. It explores all aspects of VBA programming for Access and describes the latest innovations. You'll also find several commonly used techniques and sample code to help you get started, as well as expert tips to make your code easier to maintain.
The expert author team will show you how to create and name variables, manipulate data using Data Access Object (DAO) and ActiveX® Data Object (ADO), handle errors, and create classes. You'll also learn how to utilize the latest wizards as well as modify and enhance the code that the wizards create. And you'll learn how to take advantage of key new objects, enhanced macros, and the Office Ribbon.
What you will learn from this book
- All about Access 2007's new features and the building blocks of VBA
Ways to debug your code and avoid common pitfalls
Techniques for accessing data in Access and other external data sources
Steps for creating and enhancing forms and reports
Methods for controlling access to your applications and files
How to use VBA with APIs and other Office applications
Tips for using the Windows® Registry and ADE tools
Who this book is for
This book is a comprehensive resource for Access users and VBA developers who want to increase the power of Access using VBA.
Wrox Programmer's References are designed to give the experienced developer straight facts on a new technology, without hype or unnecessary explanations. They deliver hard information with plenty of practical examples to help you apply new tools to your development projects today.
About the Author
is president of both the Pacific Northwest Access Developer Group and the Seattle Access Group, and is host for INETA’s monthly webcasts. She was the coordinating author for Access 2003 VBA Programmer's reference, and continues to publish two monthly Access newsletters. In recognition of her expertise and dedication to the Access community, Teresa was awarded Microsoft Access MVP.
Rob Cooper is a test lead on the Access team at Microsoft. During the Access 2007 release, he led the security efforts across the test team and worked on several new features including disabled mode, database encryption, Office Trust Center, and sorting, grouping and totals. Rob also led efforts around the Access object model and continues to provide direction around programmability and security in Access.
A long-time fan of Access, Rob is a frequent speaker at the Seattle Access Group and PNWADG meetings and has written for the Microsoft Knowledge Base and Access Advisor.
Geoffrey Griffith is an avid Access user who contributed to the Access 2007 product as a Software Design Engineer in Test for the Microsoft Office Access team. He enjoys participating in software community events by attending and speaking for local users groups and helping all those who would seek it.
Armen Stein is a Microsoft Access MVP and the president of J Street Technology, Inc., a team of database application developers in Redmond, Washington. Armen is President Emeritus of the Pacific Northwest Access Developers Group, and has also spoken at Seattle Access and Portland Access Users Group meetings. He has taught database classes at Bellevue Community College, and also developed and taught one-day training classes on Access and Access/SQL Server development.
Table of Contents
1. Introduction to Microsoft Access.
2. Access, VBA, and Macros.
3. New Features in Access 2007.
4. Using the VBA Editor.
5. VBA Basics.
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. Customizing the Ribbon.
13. Creating Classes in VBA.
14. Extending VBA with APIs.
15. SQL and VBA.
16. Working with Office Applications.
17. Working with SharePoint.
18. Database Security.
19. Understanding Client/Server Development with VBA.
20. Working with the Win32 Registry.
21. Using the ADE Tools.
22. Protecting Yourself with Access 2007 Security.
Appendix A. Upgrading to Access 2007.
Appendix B. References for Projects.
Appendix C. Calling Managed Code.
Appendix D. DAO Object Method and Property Descriptions.
Appendix E. ADO Object Model Reference.
Appendix F. ADO Object Argument Information.
Appendix G. The Access Object Model.
Appendix H. Windows API Reference Information.
Appendix I. Windows Registry Information.
Appendix J. Access Wizards, Builders, and Managers.
Appendix K. Reserved Words and Special Characters.
Appendix L. Naming Conventions.
Appendix M. Tips and Tricks.