O'Reilly logo

Access™ 2007 Bible by Gavin Powell, Joseph C. Stockman, Jennifer Reardon, Michael R. Groh, Michael R. Irwin, Cary N. Prague

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 32. Object-Oriented Programming with VBA

IN THIS CHAPTER

  • Learning object-oriented programming techniques

  • Understanding the benefits of object-oriented programming techniques

  • Creating class modules

  • Adding properties to class modules

  • Creating and using methods

  • Declaring, raising, and sinking events

  • Using class modules in unbound forms

A major incentive in all modern application development is to produce robust, reusable code. Microsoft Access provides a number of ways to make code more reusable, beginning with simple import or export of code modules on through building runtime code libraries.

This chapter covers one approach to creating code modules you can reuse from any Access database. The code modules we describe in this chapter define new types of objects for your Access applications. These objects include properties and methods, and you can copy the objects into other Access applications or add them to Access code libraries.

The objects you create enforce modular, object-based programming. You've likely noticed how Access is based on objects. Microsoft defines just about everything in an Access application as some kind of object. All the forms, the controls on the forms, the reports, and other visible parts of your programs are objects.

In addition, there are any number of hidden objects (such as table relationships) lurking in your program. These objects are one of the ways Access is modular in nature. Each built-in Access object (such as a table, query, or form) performs some ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required