Hi LeoTaxi, can you help me modify this code? I want to change the userpassword from another sub procedure.
Private Sub Enter_Button_Click()
Dim UserName As String
Dim userpassword As String
UserName = "User"
userpassword = "Admin"
If user_name <> UserName Then
MsgBox "Invalid Username or Password", vbCritical, "SmartCAL"
Exit Sub
End If
If password <> userpassword Then
MsgBox "Invalid Username or Password", vbCritical, "SmartCAL"
Exit Sub
End If
If user_name.Value = "" Then
MsgBox "Username is missing", vbCritical, "SmartCAL"
Exit Sub
End If
If password.Value = "" Then
MsgBox "Password is missing", vbCritical, "SmartCAL"
Exit Sub
End If
response = MsgBox("By logging in it is understood the you have read and accepted the disclaimer. Do you want to proceed using the program?", vbOKCancel + vbInformation, "SmartCAL - EULA")
If response = vbCancel Then
Exit Sub
End If
Login.Hide
End Sub
This is the code that supposed to changed the userpassword from "Sub Enter_Button_Click". I have set the new password in "Confirm_new" but the "userpassword" is outside of this below sub procedure.
Private Sub change_Click()
If old_pw.Text <> userpassword Then
MsgBox "Invalid Old Password", vbCritical, "SmartCAL"
Exit Sub
End If
If new_pw.Text <> Confirm_New Then
MsgBox "New password does not match! Please re-type the new password again.", vbCritical, "Passwords mismatched!"
Exit Sub
End If
response = MsgBox("Are you sure you want to change the existing password? Make sure to remember or note down the new password.", vbYesNo + vbInformation, "SmartCAL - Password Change")
If response = vbNo Then Exit Sub
user_name.Enabled = True
password.Enabled = True
Enter_Button.Enabled = True
old_pw_lbl.Visible = False
old_pw.Visible = False
new_pw_lbl.Visible = False
new_pw.Visible = False
change.Visible = False
MsgBox "Your password has been successfully changed!", vbInformation, "SmartCAL - Password Change"
change_pw.Enabled = True
change_rank.Enabled = True
Cancel.Visible = False
userpassword = Confirm_New.Value
Confirm_new_lbl.Visible = False
Confirm_New.Visible = False
Bookmarks