Chapter 5. Using the VBA Editor

WHAT'S IN THIS CHAPTER?

  • Learn about the VBA Editor's components and how to use them to write and test code.

  • How to use the Object Browser to explore and work with different database objects and their properties

  • Learn different techniques for testing and debugging code

You will write VBA code almost solely using the VBA Editor. In this chapter you explore the major components of the VBA Editor and learn how to use them to properly structure and debug your code. This chapter also provides some basic debugging techniques to help you save development time while you are at it.

Note

The topics in Chapters 5 and 6 are so interconnected that deciding which chapter to put first was difficult. If you get the sense that you are jumping into the middle without having covered the basics, what you think you're missing is likely in Chapter 6.

ANATOMY OF THE VBA EDITOR

You can access the VBA Editor in several ways. From anywhere in Microsoft Access, press Alt+F11 or choose from several places on Access's new Ribbon: Create, Macros, Modules, Database Tools, or Visual Basic. You can also open the VBA Editor by double-clicking a module name in the Navigation Pane or from any form or report. From the Properties dialog box, click the Events tab, select the event that you're interested in, click the Ellipses button (...), and choose Code Builder. When you first view the VBA Editor, you might be a little overwhelmed by the number of components on the screen. Take a look at the ...

Get Microsoft® Access® 2010 Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.