Well this made me laugh out loud.
Usernames and passwords are in tblUsers.
I have form frmChangePassword with these controls:
cboUserName
txtOldPassword
txtEnterNewPassword
txtConfirmNewPassword
It's working great! Except when I set the Input Mask property to Password on the password fields. Instead of writing the new password to the table, Access is writing asterisks to the table! Literally. User types "bob". It displays as *** and goes into table as ***!!!!!! Password on other screens does not accept bob, only literally typing in ***. I had to laugh.
Ideas? This is my code:
Code:
Private Sub cmdChangePassword_Click()
'Check User Name exists
If Me.cboUserName.ListIndex = -1 Then
MsgBox "Please choose your User Name. If your name is not listed, please contact an administrator.", vbCritical
Me.cboUserName.SetFocus
Exit Sub
End If
'Check old password is correct
If Me.txtOldPassword <> Me.cboUserName.Column(1) Then
MsgBox "Password is wrong. Try again or contact an adminstrator.", vbOKOnly
Exit Sub
End If
'Check new password entries are not empty
If IsNull(Me.txtEnterNewPassword) Then
MsgBox "Enter New Password cannot be blank.", vbOKOnly
Exit Sub
End If
If IsNull(Me.txtConfirmNewPassword) Then
MsgBox "Confirm New Password cannot be blank.", vbOKOnly
Exit Sub
End If
'Check new password entries are the same
If Me.txtEnterNewPassword <> Me.txtConfirmNewPassword Then
MsgBox "Your entries for new password do not match. Try again.", vbOKOnly
Exit Sub
End If
'Update table with new password
Me!txtConfirmNewPassword.SetFocus
CurrentDb.Execute "UPDATE tblUsers SET chrPassword = '" & Me.txtConfirmNewPassword.Text & "' WHERE chrUserName = '" & cboUserName & "'"
MsgBox "Congratulations! Your password has been changed.", vbOKOnly
'return to login
DoCmd.Close acForm, "frmChangePassword"
DoCmd.OpenForm "frmLogin"
End Sub