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

User Rights to a button on a form

Status
Not open for further replies.

kentwoodjean

Technical User
Oct 19, 2002
376
US
Have a form that opens when database is opened. Users will make appropriate entries and close. I would also like a button on the form for Reports but with user rights available only to leadership. Not sure how this is accomplished.

Looked at different posts and the help files for access and it is not clear to me. Thought perhaps there was some property value and also checked options under tools. Any assistance will be appreciated.
 
I think you would need to use code for this, such as the following (in the Open event of the form):

Code:
     btnMyButton.Visible = gbolUserIsLeader

In this case, gbolUserIsLeader is some global variable you previously set to True or False, depending on whatever criteria you use to determine the user is allowed to see the button.
 
My user will see the button on the form. However, when they click the button, they should get a request to enter a password. Would that mean make another form for the password that will open on the command button on the 1st form and then put the code on the password form? I have never done anything in terms of securing forms so your help is appreciated.
 
OK. I have figured out how to get the password request out there, which when the correct password is entered, an OK and Cancel button appear. Is it the OK button that allows the correct form to open, and if so, I probably need to include it in the code below I would assume. How would I enter that?

Private Sub Command25_Click()
If InputBox("Please enter the password", "Password Protected") = "mypassword" Then
'password entered ok
Else
MsgBox "Incorrect password entered", vbOKOnly, "error"
End If

End Sub
 
You may wish to look at:
Determine if user presses cancel on an input box
thread705-1109744
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top