Check the lines with the asterisks.
Try it out.


Private Sub cmdchange_Click()
'Record how many attempts have been made.
Static iTries As Integer

'Check the user's password to the one that has been saved.
If MMain.Encrypt(txtOldPassword.Text) = MMain.Password Then
If txtNewPassword.Text = txtConfirm.Text Then
'Save the new password.
MMain.Password = txtNewPassword.Text

MsgBox "Password changed.", vbInformation

Unload Me
endif '<------Add this line ******************
Else
iTries = iTries + 1
If iTries >= MAX_TRIES Then
'The user did not enter the password in the allowed number of tries.
Unload Me
Else
MsgBox "Wrong password. Try again.", vbExclamation
End If

'Highlight the old password.
With txtOldPassword
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
End If
' End If 'Kill this line ***********************
End Sub