Hide Password

  • Thread starter Thread starter George
  • Start date Start date
G

George

The other day I received help on how to password a form
from opening without a password and I was given the
following code which I inserted in my Form's On Open Event

Private Sub Form_Open(Cancel As Integer)
Dim isgm As String

isgm = InputBox("Enter Password")
If UCase(isgm) = "mypassword" Then
DoCmd.OpenForm "myformname", , , , , , ""
ElseIf UCase(isgm) <> "mypassword" Then
MsgBox ("Incorrect Password")
Cancel = True
End If
End Sub

This works great but when the password box opens as you
type in your password you can see the letters - is there
someway to tweek this to insert asterisks ****** rather
then the letters in your password.
Thanks - George
 
-----Original Message-----
The other day I received help on how to password a form
from opening without a password and I was given the
following code which I inserted in my Form's On Open Event

Private Sub Form_Open(Cancel As Integer)
Dim isgm As String

isgm = InputBox("Enter Password")
If UCase(isgm) = "mypassword" Then
DoCmd.OpenForm "myformname", , , , , , ""
ElseIf UCase(isgm) <> "mypassword" Then
MsgBox ("Incorrect Password")
Cancel = True
End If
End Sub

This works great but when the password box opens as you
type in your password you can see the letters - is there
someway to tweek this to insert asterisks ****** rather
then the letters in your password.
Thanks - George
.
One of the properties for a text box control is Input
Mask. Choose this from the list of all properties for the
text box control , or go to the data tab for properties
for the control. Then find "Input Mask", click on the ...
button all the way to the right, and select password. As
simple as that! Good Luck.
 
OK - So based on that could I create a form with just a
password field ( text Box ) lets say call the form
F-Password - could I use the below code and have it look
at the text box input to see if it matches the password in
the code ?

Thanks - George
 
George said:
OK - So based on that could I create a form with just a
password field ( text Box ) lets say call the form
F-Password - could I use the below code and have it look
at the text box input to see if it matches the password in
the code ?

Response made to a similar request.
***************
Open it using the acDialog option. This causes the calling code to pause until the
form is closed. (just like an InputBox)

Include a Cancel button that closes the form and an OK button that only hides it.
Either one of these cause your calling code to resume running.

You can then test to see if the form is still open (though hidden). if it is you
know they pressed [OK] and you can pull the entry they made from the form and then
close it. If the form is not open then you know they pressed [Cancel] and can drop
out of the routine.
***************
 
Back
Top