Garyj said:
Everyone sugguestiong is great but it would change my direction. I would like to keep the code that I am using from this form but just not allow the password to actually be shown if possible.
Is thier a way to modify the code to get the password from showing?
Thanks
I don't think there is a way to use an input mask on an input box but what you can do is create your own form and use it in place of the input box with very little change to your code and the addition of the new form. I've attached the sample database using your existing code, command button name and form names so you should just need to copy this code into your command 17 button:
Private Sub Command17_Click()
On Error GoTo Err_Command17_Click
Beep
Beep
DoCmd.OpenForm "Password"
Exit_Command17_Click:
Exit Sub
Err_Command17_Click:
MsgBox Err.Description
Resume Exit_Command17_Click
End Sub
and then import the password form from my sample database. The rest of the code that was in your command17_Click event has been adapted to the cmdOK_Click event in the password form. Here is that code:
Private Sub cmdOK_Click()
Dim stDocName As String
Dim stLinkCriteria As String
Dim strinput As String
stDocName = "status closed"
strinput = Me.txtPassword
If strinput = "santa" Then 'password is correct
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else 'password is incorrect
DoCmd.Close
MsgBox "Incorrect Password!" & vbCrLf & vbLf & "You are not allowed access ''Close CCAR''.", vbCritical, "Invalid Password"
Exit Sub
End If
End Sub
Here is the code for the cmdCancel_Click event in the form.
Private Sub cmdCancel_Click()
DoCmd.Close
End Sub
Additional info:
I've set the input mask property of txtPassword to "Password" and made the password form modal = Yes, border= dialog and pop up = yes so that the form behaves the same as an input box. To the end user it works exactly the same.
I hope this helps,
Lance