specific users/command button

D

Dan @BCBS

Can I make a command button only work for certain people?
If I add a variable to a table (check box - Boolean) which has a list of
users and only the users with this check box checked will be able to click a
command button, to everyone else it's shaded out... Can this be done?

Thanks
 
R

Rick B

Sure you can, but what prevents the user from just manually doing whatever
the button does? If the button opens a form, or deletes a record, or prints
a report, can't the user still do those things?

Also, I assume you will pulling the current user and comparing it to the
table?
 
D

Dan @BCBS

The users only have MicroSoft Runtime.
I need to add this command button to allow only a few people to be able to
delete the current record. I assume the VB code has to look at the table for
the ones with the check box True.

I think you can start to see what I'm doing, anyone can enter a record, but
if one needs to be deleted they need to get one of the specified people to
delete it..

Thanks
 
S

Sirocco

You can create a button that is enabled for only certain user groups, as
defined in the user/group accounts. When the form opens, the code is run,
and the button is enabled depending on the user. "CurrentUser" identifies
the current user. In the sample below, a field that was just edited by an
unqualified user is returned to its unedited state:

If CheckPermissions("Admins") = False Then
MsgBox "You do not have permission to change this field."
Cancel = True
Me![DateClosed].Undo
End If
 
D

Dan @BCBS

Way more info than I need, but you made me think:
Now I just have to ask - How do I read a true/false value from a seperate
table.
As you can see below I tried Table.tbluser (my variable is tbluser) but
Table does not work?


Private Sub Form_Open(Cancel As Integer)
If Table.tblUser = True Then
Command1.Enabled = True
Else
Command1.Enable = False
MsgBox "You do not have permission to change this field."
Cancel = True
Me![DateClosed].Undo
End If

End Sub


Thanks this is Critical !!!










Sirocco said:
You can create a button that is enabled for only certain user groups, as
defined in the user/group accounts. When the form opens, the code is run,
and the button is enabled depending on the user. "CurrentUser" identifies
the current user. In the sample below, a field that was just edited by an
unqualified user is returned to its unedited state:

If CheckPermissions("Admins") = False Then
MsgBox "You do not have permission to change this field."
Cancel = True
Me![DateClosed].Undo
End If




Dan @BCBS said:
The users only have MicroSoft Runtime.
I need to add this command button to allow only a few people to be able to
delete the current record. I assume the VB code has to look at the table for
the ones with the check box True.

I think you can start to see what I'm doing, anyone can enter a record, but
if one needs to be deleted they need to get one of the specified people to
delete it..

Thanks
 
Top