Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide password when typed into MsgBx 2

Status
Not open for further replies.

progressiverookie

Technical User
Apr 28, 2004
16
US
Hi,

I'm using the following code to attach a password to a command button; however, when the person enters the password, it is not hide with *********, it actually displays what the person types. How can I adjust my code below to hide what they are typing.

*****************CODE START****************
Private Sub Continue_Click()

'Attached to On Click event of Admin Password

Dim strPasswd

strPasswd = InputBox("Enter Administrator's Password", "Restricted Form")

'Check to see if there is any entry made to input box, or if
'cancel button is pressed. If no entry made then exit sub.

If strPasswd = "" Or strPasswd = Empty Then
MsgBox "No Input Provided", vbInformation, "Required Data"
Exit Sub
End If

'If correct password is entered open Employees form
'If incorrect password entered give message and exit sub

If strPasswd = "password" Then
DoCmd.OpenForm "Administrator Menu", acNormal
Else
MsgBox "Sorry, you do not have access to this form!", vbOKOnly, "Important Information"
Exit Sub
End If

End Sub
******************CODE END*****************

Thanks in advance.

Jeremy
 
Sorry, don't think there's a way to mask passwords in an inputbox. I think you need to create a custom input box, which is a new form, and for instance use the password input mask on a text control.

Roy-Vidar
 
Jeremy

It is not possible for the InputBox function to mask out a password with * characters, because of the way Access works.
Instead, you have to use a form and put a textbox on it, and set the input mask to type Password.

For an example of how to do this, together with a technique that will stop most people from being able to open the form without knowledge of the password or Access VBA, take a look at the Tek-Tips database on the Free stuff page on my website, There are two forms there that demonstrate how to password protect a form from being opened outside of the database's user interface.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top