Chapter 28. Object-Oriented Programming with VBA


  • Getting acquainted with object-oriented programming

  • Looking at how you can benefit from object-oriented programming

  • Making use of property procedures

  • Extending a class by adding properties and methods

  • Understanding events

  • Making use of class events

A major goal in all modern application development is to produce robust, reusable code. Microsoft Access 2010 provides a number of ways to make code more reusable, from simple importing or exporting of code modules to building runtime code libraries.

This chapter covers one approach to creating code modules that 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 the concept of objects. Microsoft defines just about everything in an Access application — forms, controls on forms, reports, and other visible parts of your programs — as some kind of object.

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

In this chapter, I dive ...

Get Access® 2010 Bible now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.