Results 1 to 6 of 6
  1. #1
    BLD21 is offline Advanced Beginner
    Windows 2K Access 2007
    Join Date
    Apr 2011
    Posts
    55

    MS Access 2016 Form Permission


    This has me stumped for the moment. As simple as possible I am trying to password protect a form in my database using the 'username' from windows login.

    Any ideas on how would I go about setting this up? Do I need to create a table for usernames and vba code to the 'On Open' event if so how.

    All responses are greatly appreciated.

    BLD

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    It would I think be difficult and I have to ask why you want to do this anyway.

    If you want to restrict the form to certain individuals then do some/all of the following
    1. Hide the navigation pane so users can only open objects via command buttons on forms - this is a good idea anyway.
    2. Assign your users to different groups and limit the access to certain items by user group. If you want you can still use a password to make it more secure but use the same password for all authorised users
    3. Consider hiding or disabling the buttons to open those forms to no-authorised users
    4. Disable Access options so users can't undo those settings

    Some very basic code for password protecting your form

    Code:
    Private Sub Form_Load()
    Dim PassWord As String
    PassWord = InputBox(“Enter Password”)
    If PassWord = “whatever password you choose here” Then 'open form
      DoCmd.OpenForm “name of the form that you want to password protect”
    ElseMsgBox (“Wrong Password?”)
      DoCmd.Close acForm, Me.Name
    End If
    End Sub
    Note that the above isn't particularly secure not least because the input box entry isn't masked
    I do have code for a masked input box at http://www.mendipdatasystems.co.uk/m...box/4594462216

    There are many other security measures you could add if you want to make your app as secure as possible
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    BLD21 is offline Advanced Beginner
    Windows 2K Access 2007
    Join Date
    Apr 2011
    Posts
    55
    Thank you. I neglected to add I've already hid the navigation pane and I am using the code above to restrict access to a report.

    I would like to create a table using usernames from the windows login giving them access to the form probably based on some kind of group security level.

    I have other forms and buttons that are not restricted I just want this particular form to be restricted to certain users.

    Hope this makes sense.

    BLD

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Fine so my suggestions were valid. Just forget the idea of matching form passwords to users windows logins.
    In case you are interested see my articles on ways to improve security in Access databases http://www.mendipdatasystems.co.uk/i...ity/4594461803
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    BLD21 is offline Advanced Beginner
    Windows 2K Access 2007
    Join Date
    Apr 2011
    Posts
    55
    Ok, Do you have any experience using the DoCmd.RunCommands below?


    DoCmd.RunCommand acCmdUserAndGroupAccounts to add or delete user accounts.
    DoCmd.RunCommand acCmdUserAndGroupPermissions to edit user permissions.
    DoCmd.RunCommand acCmdUserLevelSecurityWizard to run security wizard.

  6. #6
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    These all apply to the old user level security for MDB files which was deprecated in A2007.
    In other words no longer relevant as you have A2007
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. Replies: 2
    Last Post: 03-25-2019, 12:59 AM
  2. Replies: 4
    Last Post: 08-07-2018, 05:38 AM
  3. Automating Outlook 2016 from Access 2016
    By jcc285 in forum Programming
    Replies: 10
    Last Post: 09-30-2017, 01:53 PM
  4. Access permission
    By italpor in forum Access
    Replies: 1
    Last Post: 11-18-2010, 05:52 AM
  5. Access 2007 permission
    By truthseeker170 in forum Security
    Replies: 1
    Last Post: 07-09-2009, 08:11 PM

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