Chapter 10. VBA Programming Fundamentals

IN THIS CHAPTER

  • Converting macros to VBA

  • Using the Command Button Wizard to create VBA code

  • Understanding the basics of VBA

  • Understanding modules

  • Creating a new module

  • Using the Module window

If you have created or worked with a simple Access application, you most likely created the application's operations by using macros. Although macros provide a quick and easy way to automate an application, writing Visual Basic for applications (VBA) modules is the best way to create applications. Using data access, repetitive looping, and branching, and adding features that macros simply cannot provide gives you more control over application development. In this chapter, you learn how to build an application framework and how to extend the power of an application using VBA.

Note

Use the database file Chapter10.accdb in this chapter.

Understanding the Limitations of Macros

For a number of reasons, this book does not extensively cover Access macro creation. To begin with, there are enough important topics so that we have to choose which topics are covered in detail. Also, macros are pretty easy to learn on your own, and they are quite well documented in the Access online help.

But, by far, the biggest reason not to document macros is that, for the most part, macros do not belong in professionally built applications. At the very least, macros occupy a relatively minor position in most applications because of their rather serious limitations. Perhaps the greatest issue ...

Get Access™ 2007 Bible 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.