O'Reilly logo

Beginning Access™ 2007 VBA by Denise Gosnell

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

14.4. Building the Class Module for the Objects

Next, turn your attention to writing the code that will implement the desired features of your Customer Service application. VBA code can be written in various places, such as class modules that are independent or associated with a form, as well as in standard modules. Just as in the prior case study, you will create the custom class module first, then the standard modules, and finally the code for the forms to call the other modules. An example of how the Project Explorer will look in the Visual Basic Editor when you're finished is shown in Figure 14-25.

Figure 14.25. Figure 14-25

In this Customer Service application, you create one custom class module that will store the values for the current Customer.

An object diagram for the Customer class is shown in Figure 14-26.

Figure 14.26. Figure 14-26

The properties correspond to the data elements on the View/Manage Customer Accounts form for the most part, except that the values for the Plan History records are not shown here. The methods represent various actions that should be taken on the object. You will also write numerous other procedures that are not in the class module, as you will see later.

Try It Out: Building the clsCustomer Class

Let's get started and build the clsCustomer ...

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