SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 162 | Next

Jim DeMarco

"Pro Excel 2007 VBA"

These classes will store the data for each object
(person, address, equipment, and access level) and will contain any business rules for each
object.
Add a new class module to the project and name it cPerson. Add three more class modules,
naming them cAddress, cEquipment, and cAccess. Our cPerson object will contain one
each of cAddress, cEquipment, and cAccess objects. To keep them in sync, we??™ll add an ID
property to each of our four business object classes.
In each class, add the following module-level declaration:
Private m_lngID As Long
Then add the Property Get and Let in each class:
Public Property Get ID() As Long
ID = m_lngID
End Property
Public Property Let ID(newID As Long)
m_lngID = newID
End Property
Save your work, and let??™s concentrate on our cPerson class. Each class essentially mirrors
its input screen from our earlier UI design. Add the following module-level variable declarations
to the cPerson class:
CHAPTER 4 n USERFORMS 161
Private m_sFName As String
Private m_sMidInit As String
Private m_sLName As String
Private m_dtDOB As Date
Private m_sSSN As String
Private m_sJobTitle As String
Private m_sDepartment As String
Private m_sEmail As String
Private m_oAddress As cAddress
Private m_oEquipment As cEquipment
Private m_oAccess As cAccess
Notice that in addition to the data inputs from our screen design, we??™ve included objects
to hold the address, equipment, and access information.
The first thing we??™ll do here is initialize our cPerson class and set some default values.


Pages:
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174