This should be the Address screen. Notice
that both navigation buttons are now enabled, as shown in Figure 4-32.
3. Click the Previous button to navigate back to the Personal screen, and the Previous
button will no longer be active.
4. Click the Next button until you are at the last screen as defined on our configuration
worksheet. This should be the Network Access screen. The Next button will no longer
be enabled, as shown in Figure 4-33.
5. Stop the form by clicking the X button.
CHAPTER 4 n USERFORMS 186
Figure 4-32. Both navigation buttons are enabled.
Figure 4-33. The Next button is disabled on the last screen in the wizard.
Saving the Employee Record
We??™ve done a lot of work so far, and we??™ve got some pretty neat functionality provided to our
UserForm from our custom objects. The only thing missing is saving the data to the EmpData
worksheet.
CHAPTER 4 n USERFORMS 187
Normally, we might create a subroutine, name it something like SaveData(), and call it
from our cmdSave_Click event??”but our cHRData class already has a SaveEmployee method. We
can call that directly from cmdSave_Click with no need to create a save function on our form.
Insert the following code in the cmdSave_Click event:
Private Sub cmdSave_Click()
Dim oHRData As cHRData
Set oHRData.Worksheet = Sheets("EmpData")
oHRData.SaveEmployee m_oEmployee
Set oHRData = Nothing
End Sub
After setting the Worksheet property so that our cHRData object knows where to save the
data, we call the SaveEmployee method, passing in our m_oEmployee object, which contains all
the data to save.
Pages:
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195