Back in Chapters 4 and 5, we introduced the concept of object-oriented programming. We looked at the Access object model and the Data Access Object hierarchy and how working with these different types of objects is really at the heart of programming in VBA. In this chapter, we are going to look at how we can create our own objects and how we can extend the functionality of Access and VBA.
For many people, the idea of object-orientation seems a bit scary. There are all those long words like instantiation, encapsulation, inheritance, and (my favorite) polymorphism . Not to worry - the implementation of class modules and user -defined objects in Access 2000 is actually fairly simple. It may not give you the flexibility of tools such as Visual C++, but what that means in turn is that it is very easy to pick up. Hopefully, this chapter will show you just how easy it is, and by the time you finish you should have added a very powerful tool to your programming armory.
We'll be looking at the following topics in this chapter:
What objects are
The benefits of object-based programming
Building and instantiating custom objects
Building object hierarchies through collections
Custom properties and methods for forms
Creating multiple instances of a form