How to define accessibility for different users (1 Viewer)

born2live

Registered User.
Local time
Today, 13:26
Joined
Jul 19, 2012
Messages
26
Hi guys,
I have a multi-user database. I would like based on the logged-in user, some buttons and controls in different forms be disabled and the others be enabled.
There is a login form that gets the username; I made also a function to define authorities for users in it.
My plan is that when user enters to the database, on load of the main menu the function calls and disables the defined controls in different forms.
I tried to use this kind of codes:

Function User_1()
[Forms]![frmMainMenu].[cmdUpdateDatabase].Enabled = False
[Forms]![frmChooseReports]![cmdOrdersFollowUpReports].Enabled = False
End Function

Function User_2()
[Forms]![frmMainMenu].[cmdChooseCharts].Enabled = False
End Function


But this code only works for the forms that are opened at the moment and if one of them is closed the system gives Error.

Could anyone help me on solving this matter?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 08:56
Joined
Feb 19, 2013
Messages
16,553
you can only modify control properties in open forms, so your code really needs to be in each form open event to check the users credentials and then set the control properties accordingly
 

born2live

Registered User.
Local time
Today, 13:26
Joined
Jul 19, 2012
Messages
26
you can only modify control properties in open forms, so your code really needs to be in each form open event to check the users credentials and then set the control properties accordingly

Thank you CJ_London
 

Users who are viewing this thread

Top Bottom