if
the original password is correct and if the new password and new password
confirmation (typical deal, you know, with "enter new password" and "re-type
password") match.
The problem is that if ANYTHING or even if nothing is entered in OldPass,
the password is changed. It's as if the code doesn't care whether the old
password matches what is entered as the old password in the form or not. The
following is the code I have behind the "change password" button:
If DLookup("Password", "tblPW", "[Department] = 1") <> Me.OldPass Then
MsgBox "You have not entered the correct ORIGINAL password",
vbOKOnly, "Wrong Original Password"
Me.OldPass = ""
Me.OldPass.SetFocus
Exit Sub
ElseIf Me.PassChange <> Me.PassChange2 Then
MsgBox "New Password and New Password Confirmation do not match!",
vbOKOnly, "Confirmation Error"
Me.PassChange = ""
Me.PassChange2 = ""
Me.PassChange.SetFocus
Exit Sub
Else
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryPChange" 'this runs the update query which
enters the value in the form's PasChange field in that department's password
field
DoCmd.SetWarnings True
MsgBox "Your password has been changed. Be sure to memorize it",
vbOKOnly, "Password Changed"
DoCmd.Close
End If
I've tried changing the OldPass reference in the Dlookup line to
me.OldPass.text and me.oldpass.value, all with the same result. I can
change the password regardless of what I put (or don't put) in the OldPass
field on the form.
Can someone tell me why this is?
Any help is greatly appreciated, and thanks for reading.