simeon_rose
01-11-2001, 02:06 AM
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.
thank you in advance,
simeon.
|
View Full Version : setting passwords on command buttons simeon_rose 01-11-2001, 02:06 AM 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. Chris RR 01-11-2001, 06:27 AM 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).] simeon_rose 01-11-2001, 10:00 AM 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? BarkerD 01-11-2001, 10:34 AM 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 Talismanic 01-11-2001, 10:44 AM 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).] simeon_rose 01-11-2001, 11:11 AM thank you! that's perfect! i don't know how many times you've helped me now, but it's much appreciated, cheers! Talismanic 01-11-2001, 11:53 AM No problem, it is a good thing when you can give back to the community! OliviaS 08-03-2001, 05:35 AM So you just Copy and paste this code in the cmd button you want to restrict? |