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

MS Access Hide or Display tab based on user privelege 1

Status
Not open for further replies.

dan08

Technical User
Jan 7, 2013
51
0
0
US
I am working on making a set of forms that will change depending on the privileges of the user. I can get the persons username then determine their privileges from a table. So how can I use that to hide certain forms or tabs if the person doesn't have the privilege to use them? e.x. if person is not admin then hide admin tab.

This is an ongoing project and I am running in to a lot of hurdles when it comes to locking down privileges. Does anyone know of some resources or tutorials on securing or restricting users in Access
 
Security comes in several different flavors.... if your interested in data security check out this recent thread...

thread181-1713802

That being said there is no 'hide' method in access but there is a visible property. Just set the control's visible property to no and it is hidden. People cannot use hidden controls (although code still can).


Beyond that if you are doing this sort of application security, (I would highly recommend securing the data as well) then you have to decide what makes sense for controlling security. The most flexible would be to maintain the controls and forms in a table and have code that loops through and sets the visible property appropriately. I have also seen people use the tag property to control such things... So if the control is in group X and X allows tag Z then if control has tag Z it is visible. In either case I would write a procedure that takes a form as a parameter ByRef and use it to loop the controls and then call it from every form's on open event (on load will work if I'm missing something that would blow up in On open).

Personally, since any groups you have will be in tables anyway, I would just go ahead and keep the control names data driven. That way you can review it easier and I at least tend to make minor mistakes on properties that aren't caught... Others may go for tag property (fewer data reads so it should be faster).
 
I like the tag idea. I could just tag controls as 'all' or 'admin' and hide appropriately. The data is in a backend SQL server db and is filtered down on the server-side using views, so that should keep the data secure. Thanks for the reply.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top