im a beginner in programming, and im currently working on my first project which is the book borrowing system.
my only problem is that everytime i try to change the password of my system.. when i hit the cancel button the previous password disappears and u i can easily enter in the system without inputting password.where do u think is the problem?
thanks.
my only problem is that everytime i try to change the password of my system.. when i hit the cancel button the previous password disappears and u i can easily enter in the system without inputting password.where do u think is the problem?
thanks.
Code:
Private Sub cmdCancel_Click()
If MsgBox("are you sure you want to cancel?", vbQuestion + vbYesNo, "Cancel") = vbYes Then
Data1.Recordset.CancelUpdate
normalButton
Call txtinactive
cmdEdit.Enabled = True
cmdSave.Enabled = False
cmdCancel.Enabled = False
Else
End If
End Sub
Private Sub cmdEdit_Click()
If txtuname = "Administrator" Then
MsgBox "Only Password can edit", vbInformation, "Borrower's List System"
txtuname.Visible = False
End If
Data1.Recordset.Edit
lblnew.Visible = True
lblpass.Visible = False
lbluser.Visible = False
txtuname.Visible = False
lblAdmin.Visible = True
Call add_record
txtpass = ""
txtretype = ""
txthint = ""
End Sub
Sub add_record()
txtuname.Enabled = False
txtpass.Enabled = True
txtretype.Enabled = True
cmdSave.Enabled = True
cmdCancel.Enabled = True
End Sub
Private Sub txtinactive()
txtpass.Enabled = False
txtretype.Enabled = False
End Sub
Private Sub normalButton()
cmdEdit.Enabled = True
cmdSave.Enabled = False
cmdCancel.Enabled = False
End Sub
Private Sub cmdMain_Click()
Unload Me
frmMenu.Show
End Sub
Private Sub cmdSave_Click()
If txtretype = "" Or txtpass = "" Or txthint = "" Then
MsgBox "Incomplete Information!", vbError + vbOKOnly, "Admin account"
ElseIf txtretype = "" Then
MsgBox "re-type password first", vbInformation + vbOKOnly, "Admin account"
ElseIf txtpass = txthint Then
MsgBox "You password and passwordhint must not be the same", vbInformation + vbOKOnly, "Password"
txthint = ""
ElseIf txtpass = txtretype Then
If MsgBox("Are you sure you want to save changes?", vbQuestion + vbYesNo, "Save Changes") = vbYes Then
Data1.Recordset.Edit
Data1.Recordset.Fields("Confirm").value = txtretype.Text
Data1.Recordset.Fields("Password").value = txtpass.Text
Data1.Recordset.Fields("Hint").value = txthint.Text
Data1.Recordset.Update
MsgBox "Account has been Successfully Updated.Program will restart to update your new password.", vbDefaultButton3 + vbMsgBoxSetForeground, " Account"
cmdEdit.Enabled = True
frmLogin.Show
Unload Me
Call normalButton
Call txtinactive
cmdEdit.Enabled = True
cmdSave.Enabled = False
cmdCancel.Enabled = False
End If
Else
MsgBox "password not match", vbInformation + vbOKOnly, "admin account"
End If
End Sub
Private Sub Form_Load()
lblAdmin.Visible = False
lblnew.Visible = False
Data1.Visible = False
End Sub
Comment