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 180 | Next

Jim DeMarco

"Pro Excel 2007 VBA"


Add the following code to the cmdNext_Click event:
Private Sub cmdNext_Click()
Dim iNext As Integer
StoreData
iNext = m_oWizard.NextPage
Me.MultiPage1.Value = m_colSteps(CStr(iNext)).Order - 1
Me.MultiPage1.Pages((m_colSteps(CStr(iNext)).Page) - 1).Caption = ??
m_colSteps(CStr(iNext)).Caption
ShowNextPage "up"
End Sub
The first thing we need to do before we move to the next step in the wizard is retain the
values entered on the current form. The StoreData method determines which step the user is
on and calls the correct store method based on that location, as shown in Listing 4-4.
Listing 4-4. The StoreData Method Calls the Correct Method for Each Step in the Wizard.
Private Sub StoreData()
Select Case m_oWizard.CurrentPage
Case 1
StorePerson
Case 2
StoreAddress
Case 3
StoreEquipment
Case 4
StoreAccess
End Select
End Sub
The code for the store method follows:
Private Sub StorePerson()
With m_oEmployee
.FName = Me.txtFname.Value
.MidInit = Me.txtMidInit.Value
.LName = Me.txtLname.Value
If Len(Me.txtDOB.Value & "") > 0 Then
.DOB = Me.txtDOB.Value
End If
CHAPTER 4 n USERFORMS 183
.SSN = Me.txtSSN.Value
.Department = Me.cboDept.Text
.JobTitle = Me.txtJobTitle.Value
.Email = Me.txtEmail.Value
End With
End Sub
Private Sub StoreAddress()
With m_oEmployee.Address
.StreetAddress = Me.txtStreedAddr.Value
.StreetAddress2 = Me.txtStreetAddr2.Value
.City = Me.txtCity.Value
.State = Me.txtState.Value
.ZipCode = Me.txtZip.Value
.PhoneNumber = Me.


Pages:
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192