|
security
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Passwords and alerting users if not authorizedI have a database with levels of authorization for either "Admin" or "Users".
Two questions: 1. If a user wants to open a form in edit mode, they are not allowed and receive an error message. So far so good. I would now like them to receive a MsgBox message, like "You are not authorized to use this form". I am not sure which event to attach the code on. Please advise. (OnError does not seem to work.) 2. Can I grey-out menu items depending on the user's authorization? Or do I have to make multiple menus? Thank you. On Mon, 5 Jun 2006 11:06:01 -0700, Ken Cobler <KenCob***@discussions.microsoft.com> wrote:
>I have a database with levels of authorization for either "Admin" or "Users". You'd be better off determining if they can open the form BEFORE they open it ... something like the code snippet below:> Two questions: > >1. If a user wants to open a form in edit mode, they are not allowed and >receive an error message. So far so good. > >I would now like them to receive a MsgBox message, like "You are not >authorized to use this form". I am not sure which event to attach the code >on. Please advise. (OnError does not seem to work.) Sub btnOpenMyForm_Click() <other code> If Not UserInGroup(CurrentUser, "Admins") Then Msgbox "Sorry, you can't open this form" Else DoCmd.OpenForm "YourForm" End If End Sub '/Note: This function culled from a newsgroup posting by Sandra Daigle Function UserInGroup(strUser As String, strGroup As String) As Boolean Dim strUserName As String On Error Resume Next strUserName =DBEngine.Workspaces(0).Groups(strGroup).Users(strU ser).Name IsUserInGroup =(Err = 0) End Function I've been having trouble reaching the online version of the Security FAQ recently, but here's a downloadable version: http://support.microsoft.com/kb/207793/en-us > You can enable/disable menu items based on group membership. You'd first determine group memberships using the code as>2. Can I grey-out menu items depending on the user's authorization? Or do >I have to make multiple menus? above, then you can use the example at the link below to enable/disable menu items: http://support.microsoft.com/?kbid=198464 > Scott McDaniel>Thank you. scott@takemeout_infotrakker.com www.infotrakker.com
Delete LDB file
User Account Access to User-Level Secured Database Macro security in runtime version You do not have necessary permissions error... Help - Multi User Database Security Permission Secure multiuser applications w/out securing existing/new database Permissions Don't Seem to Be Working My mdw file doesn't ask logins anymore !!! Help ! HELP!!! Access 2007 and .mdw |
|||||||||||||||||||||||