Password on form

G

Guest

I have a form with a button that opens another form. I have a password set to
open up the other form. It is something like this;

Private Sub Form_Open(Cancel As Integer)
Const strFormPassword As String = "Password"

If InputBox("Please Enter Password") <> strFormPassword Then
MsgBox "Password Incorrect", vbOKOnly
Cancel = True
End If

End Sub

How can I set this up so that when the password is entered, it shows up with
asterisks instead of the password itself. Can someone help me with this?
Thanks
 
P

Paul Doree

Don't use an Input Box. Use a form instead with an unbound field for the
user to enter the password. You can set the input mask property to
'password' format so that it will only show the asterisks
 
R

Rick Brandt

Ron said:
I have a form with a button that opens another form. I have a
password set to open up the other form. It is something like this;

Private Sub Form_Open(Cancel As Integer)
Const strFormPassword As String = "Password"

If InputBox("Please Enter Password") <> strFormPassword Then
MsgBox "Password Incorrect", vbOKOnly
Cancel = True
End If

End Sub

How can I set this up so that when the password is entered, it shows
up with asterisks instead of the password itself. Can someone help me
with this? Thanks

You have to create your own form to use instead of using an InputBox. I'm not
sure about opening a form in the open event of another, but as long as there is
no problem with that you simply open the password form using the acDialog
argument which will cause the code in the form being opened to pause until the
passwor form is closed or hidden.

In your password form have two buttons [ok] and [cancel]. Have [cancel] close
the form and [ok] merely hide it. Then the next line of code in the form being
opened can test to see if the password form is still open. If it is you know
they pressed [ok] at which point you retrieve the password they entered, close
the password form and proceed as you are doing now. If the password form is no
longer open when you test for it then you know they presssed [cancel] and you
can also cancel the protected form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top