Disabling buttons depending on users rights

jobro

Registered User.
Local time
Yesterday, 16:42
Joined
Nov 3, 2007
Messages
21
Here is one for you.

My start form has a tabcontrol and on the first page it has 8 buttons, each taking you to a specific form.

Say that a worker is accessing the database and only have access to the certain forms. I know that button.enabled = false deactivates a button, but how do you read the status of an user's rights and disable a button from it?
 
How are you setting the user rights?

As to the disabling... I use a Select Case on the forms load event.

Select Case UserLevel
Case 1
me.buttonone.enabled = true
case 2
me.buttonone.enabled - false
end select

Dave
 
Look at "DemoAdminA2000.mdb"
I often use this method. Open MainForm and see.
 

Attachments

It is quite intresting I must say. The users log on to my database at first. Then when he is online he'll see the form with the buttons.
 
my way...

created a USERS table with 'authorizations'
for ex. AUTH_INVOICE_PRINT as YES/NO field

on the moment that the form is loaded the script will check with a function procedure...

BUTTON_INVOICE_PRINT.VISIBLE = CHECKAUTHORIZATION("AUTH_INVOICE_PRINT")

the function procedure CHECKAUTHORIZATION is a simple dlookup

PUBLIC FUNCTION CHECKAUTHORIZATION(REF)
CHECKAUTHORIZATION = DLOOKUP(REF,"USERS","USERID=" & USERID)
END FUNCTION

USERID is a global variable of the USER who is logged in...

very simple & I can authorize each user for seperate tasks... did worked with levels too, but I prefer to authorize them detailed...
 
i was also going to suggest the visible route for the buttons. cant click on something you can not see, which is more user friendly than a button that does not work. a non functional button creats lots of complaints of parts of the software not working, which removes credibility of a system.
non working features works against getting buy-in from end users if it is being deployed in an area that has been traditionally "paper n labour"
is easy to do with

BUTTON_INVOICE_PRINT.ENABLED = CHECKAUTHORIZATION("AUTH_INVOICE_PRINT")

the reason why I use the visible option is because then the users can't see the button at all and don't getting confused about it... and second reason, and the most important, it don't give them any ideas to nag to me that they need access to that button...

the assistent can't for ex. don't delete any records or print it out... so he don't see any buttons related to it.. and he thinks that it don't excist... hahahaha
 
Fair enough. I still think that the buttons needs to be visible but not accessable for the users.I set up security with the guide in Access 2k3, and so I opened up the file it created. I can see the acounts there and I was thinking if one could create a relation between that file and the database I'm working in. If so then you could let the database read the rights and then disable the buttons from there. Am I on the right way here?
 

Users who are viewing this thread

Back
Top Bottom