I have created a table called EmployeeTable and am done with login page, But problem is, when ever a user try to change password it shows "password change sucessfull" but the new password not been updated(replaced) in place of old password in employee table. so am attaching the code which i have written in VB(Ms access 2003). pls give me a code to update password.. (For Esay understanding I have provided the space where i need to update my codes in program (before Mess box "password change sucessful"))
Expand|Select|Wrap|Line Numbers
- Private Sub SaveExit_Click()
- 'Check to see if data is entered into the Employee ID box
- If IsNull(Me.EmployeeID) Or Me.EmployeeID = "" Then
- MsgBox "You must enter a Employee ID.", vbOKOnly, "Required Data"
- Me.EmployeeID.SetFocus
- Exit Sub
- End If
- 'Check to see if data is entered into the old password box
- If IsNull(Me.oldpassword) Or Me.oldpassword = "" Then
- MsgBox "You must enter a Old Password.", vbOKOnly, "Required Data"
- Me.oldpassword.SetFocus
- Exit Sub
- End If
- 'Check to see if data is entered into the New password box
- If IsNull(Me.newpassword) Or Me.newpassword = "" Then
- MsgBox "You must enter a New Password.", vbOKOnly, "Required Data"
- Me.newpassword.SetFocus
- Exit Sub
- End If
- 'Check to see if data is entered into the New password box
- If IsNull(Me.confirmpassword) Or Me.confirmpassword = "" Then
- MsgBox "Please Confirm Password.", vbOKOnly, "Required Data"
- Me.newpassword.SetFocus
- Exit Sub
- End If
- 'check to see the Password in EmployeeTable
- If Me.oldpassword.Value = DLookup("Password", "EmployeeTable", "[EmployeeID]=" & Me.EmployeeID.Value) Then
- EmployeeID = Me.EmployeeID.Value
- Else
- MsgBox "Old Password Not Matched . Please Try Again", vbOKOnly, "Invalid Entry!"
- Me.oldpassword.SetFocus
- Exit Sub
- End If
- 'check to see the New Password should match with confirm Password
- If Me.newpassword.Value = Me.confirmpassword.Value Then
- 'Replace Password In Employee Table by New passsword
- MsgBox "Password Change Sucessfull", vbOKOnly, "Invalid Entry!"
- 'Close Change Password form and open LogIN screen
- DoCmd.Close acForm, "changepassword", acSaveNo
- DoCmd.OpenForm "LogIN"
- Else
- MsgBox "New Password Not Matched . Please Try Again", vbOKOnly, "Invalid Entry!"
- End If
- End Sub