Results 1 to 5 of 5
  1. #1
    Evgeny's Avatar
    Evgeny is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    85

    Form Restrictions

    Hi guys, it there any way to restrict form control based on user? (logged in user).



    Regards,

    Evgeny

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    depends on what you mean by CONTROL

  3. #3
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    The only way you could do something like that would be to have a Table in your database with all the user names in it and fields for any Forms, etc. that you want to limit access to.

    Then, you have VB code that runs a check each time a user attempts to Open a Form similar to the following:
    Code:
    ' Assume rstUserAccess is linked to your table and you're using
    ' Yes/No fields for each Form you want to limit control too.
    
    strCriteria = "[Username]='" & CurrentUser() & "' And [MyForm]=TRUE"
    
    rstUserAccess.FindFirst strCriteria
    
    If rstUserAccess.NoMatch Then
      MsgBox "You don't have permission to view this Form!"
      Exit Sub
    End If
    
    DoCmd.OpenForm frmMyForm
    EDIT: Fixed my syntax so that the code snippet would actually work (added the text in bold).
    Last edited by Rawb; 04-22-2010 at 02:12 PM.

  4. #4
    Evgeny's Avatar
    Evgeny is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    85
    Thank you. I will give it a go

  5. #5
    Evgeny's Avatar
    Evgeny is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    85
    Quote Originally Posted by ajetrumpet View Post
    depends on what you mean by CONTROL
    Things like table, forms access, operations of buttons and etc....

Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums