How It Works

First, you created a new class module in the database and named it clsCar. You then added the local variables that are used later by the Property Get and Property Set procedures for each property, as shown in the following code.

Dim dblVehicleIdNumberVal As Double

Dim intMakeIdVal As Integer

Dim intModelIdVal As Integer

Dim intModelYearVal As Integer

Dim intMileageVal As Integer

Dim intColorIdVal As Integer

Dim intInteriorTypeIdVal As Integer

Dim intInteriorColorIdVal As Integer

Dim intTransmissionTypeIdVal As Integer

Dim intStatusIdVal As Integer

Dim dtReceivedDateVal As Date

Dim dtSoldDateVal As Date

Dim intSoldToPersonIdVal As Integer

Dim strPhotoVal As String

Dim strSpecialFeaturesVal As String

Next, you added Property Get and Property Let procedures for each property in the class. For example, you added Property Get and Property Let procedures to the VehicleIdNumber property to specify what happens whenever the property value is retrieved or assigned, respectively.

Public Property Get VehicleIdNumber() As Double

VehicleIdNumber = dblVehicleIdNumberVal End Property

Public Property Let VehicleIdNumber(ByVal Value As Double)

dblVehicleIdNumberVal = Value End Property

You can use this class later on in the chapter to see one or more of these properties in action.

0 0

Post a comment