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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HOW CAN YOU PASSWORD A BUTTON?

Status
Not open for further replies.

chubby

Programmer
Apr 28, 2001
278
0
0
US
I have a form that has a button on it that opens another
form containing cartoon pics. I like would to password the button so only me and three other adults have access. The staff don't want the kids to have access to all the pics...
 
Some simple code like
[tt]
Private Sub cmdCartoons_Click()
Dim PassWord As String
PassWord = InputBox ("Enter the Password")
If PassWord = "I'm An Adult" then
' Open the form
Else
MsgBox ("You're not authorized")
End If
End Sub
[/tt]

More security can be had by storing the password in a database so that you can change it or by using one of the more advanced methods to mask the password so that you can't see what's being typed.
 
Thanks a million. I love it! But there's one problem. It will not open up the form after I entered the correct pass word. It comes up with the password box, I type in the and that's it. Did I miss something? How do I get it to open up the form.
 
Presumably you have code now that, when you click the button, opens the form. Just copy and paste that code where I have the comment ' Open the form
 
Man-0-man you're awesome!!! I wish I would take a class or something learn VBA and get half as good as you. Thanks!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top