setting passwords on command buttons

simeon_rose

Registered User.
Local time
Today, 13:56
Joined
Nov 4, 2000
Messages
34
hi, could anybody tell me how i can set a password on a command button that opens a form that only administrators should be able to open?
thank you in advance,
simeon.
 
I don't think that there is a way to restrict the use of a button without doing a little code.

Usually, we tie application security to the userid of the person logged in. Sometimes it's enough to pick up tne network ID & verify that against a table of "special" users (or do this in hard code, if the list is exceptionally stable.) Other times, we do a full password/userid login screen when the application opens.

You can either let everyone see the restricted button, and check security in the button's "on click" event, or you can check the security when you load the form, and make the button visible and enabled only for the users who should have access to it.

[This message has been edited by Chris RR (edited 01-11-2001).]
 
hi...i don't mind everyone being able to see the button, in fact this would be preferable, and i don't mind having to put a bit of code behind the button - however, i've got no idea how to do this. in the current 'on-click' event is an 'open form' command...how can i state that the form should only be opened after the correct password has been entered?
 
I forget the exact function you need, but it is similar to the CurrentUser() function.

As long as you set up a group in the security settings, and assign the correct people to the group, you can check if the current user is a member of the specific group.

Duane Barker
 
Here you go simeon_rose:

Private Sub cmdOpenForm_Click()

Dim strPasswd

strPasswd = InputBox("Enter Password", "Restricted Form")

If strPasswd = "YourPassWord" Then

DoCmd.OpenForm "YourFormName", acNormal

Else

Exit Sub

End If

End Sub



[This message has been edited by Talismanic (edited 01-11-2001).]
 
thank you! that's perfect!
i don't know how many times you've helped me now, but it's much appreciated, cheers!
 
No problem, it is a good thing when you can give back to the community!
 
So you just Copy and paste this code in the cmd button you want to restrict?
 

Users who are viewing this thread

Back
Top Bottom