Results 1 to 4 of 4

Login restrictions

  1. #1
    fletcjas is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2018
    Posts
    13

    Login restrictions

    Hello
    I'm not sure if this is the right thread, but here is my question.
    I have a database that requires users to login.
    I have 2 tables:


    DBUsers - This holds users data such as username, password and security level
    Security Levels - This holds the list for the security levels eg 1 = admins, 2 = Users, 3 = Reports Only

    At current, when a user logs in the code runs as follows:
    Code:
    UserLevel = DLookup("UserSecurity", "DBUsers", "UserName = '" & Me.TxtLoginID.Value & "'")
            TempPass = DLookup("password", "DBUsers", "UserName = '" & Me.TxtLoginID.Value & "'")
            ID = DLookup("UserID", "DBUsers", "UserName = '" & Me.TxtLoginID.Value & "'")
            If (TempPass = "password") Then
            Me.TxtLoginID.Value = ""
            Me.TxtPassword.Value = ""
            Me.InfoWrong.Visible = False
                MsgBox "Please provide a new secure password.", vbInformation, "New Password Required"
                DoCmd.OpenForm "frm_Admin_UpdateDBUsersInfo", , , "[UserID] = " & ID
            Else
                ' Admin Users
                If UserLevel = 1 Then
        Call CreateSession(LngUserID)
        Call LogMeIn(LngUserID)
                DoCmd.Close
                DoCmd.OpenForm "frm_Login_MAdmin_Portal"
                DoCmd.OpenForm "frm_Admin_InactiveShutDown", , , , , acHidden
                    Exit Sub
            Else
                'General Users
                If UserLevel = 2 Then
        Call CreateSession(LngUserID)
        Call LogMeIn(LngLoginId)
                DoCmd.Close
                DoCmd.OpenForm "frm_Login_GAdmin_Portal"
                DoCmd.OpenForm "frm_Admin_InactiveShutDown", , , , , acHidden
                Exit Sub
            Else
            'Reports Only Users
                If UserLevel = 8 Then
        Call CreateSession(LngUserID)
        Call LogMeIn(LngUserID)
                DoCmd.Close
                DoCmd.OpenForm "frm_Admin_InactiveShutDown", , , , , acHidden
                DoCmd.OpenForm "frm_MainPages_Reports"
                Exit Sub
    Click image for larger version. 

Name:	cc.PNG 
Views:	21 
Size:	28.8 KB 
ID:	35446
    I have a login form that is different for each user type, I am looking at having just one form, and each button is controlled by a level access, so level one can have all buttons/tabs, but level 3 can have some, If this makes sense.

    I am happy to create a new table if required, this could also be controlled by 'tick' boxes.

    Thanks in advance.

    Jase

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    44,973
    I do this. Code in form Open event sets visibility of controls based on user permissions.
    To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. Attachment Manager is below Advanced editor window, click Go Advanced below Quick Reply window.

  3. #3
    fletcjas is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2018
    Posts
    13
    Hey June7,Thank you for the reply.
    How would I pass through the security level value to the menu? I'm guessing it would be something like:
    Code:
    If VALUE = 1 then
    me.button.enabled = false
    me.button.enabled = true
    me.button.enabled = false
    me.button.enabled = false
    else
    If VALUE = 2 then
    me.button.enabled = false
    me.button.enabled = True
    me.button.enabled = false
    me.button.enabled = True
    ......
    Would i need to have the value displayed somewhere for this?

    Thanks again

    Jase

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    44,973
    I have user info on a form that never closes - MainMenu - so it is always available for reference. MainMenu is BOUND to Users table and Login procedure opens filtered to user.
    To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. Attachment Manager is below Advanced editor window, click Go Advanced below Quick Reply window.

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

Similar Threads

  1. comboBox restrictions
    By ShostyFan in forum Access
    Replies: 3
    Last Post: 01-21-2017, 04:18 PM
  2. Replies: 1
    Last Post: 07-08-2014, 12:47 PM
  3. restrictions for different users
    By joe1987 in forum Access
    Replies: 7
    Last Post: 12-11-2011, 04:05 PM
  4. help with creating data restrictions
    By aburaed in forum Access
    Replies: 3
    Last Post: 08-30-2011, 04:41 PM
  5. Form Restrictions
    By Evgeny in forum Forms
    Replies: 4
    Last Post: 04-22-2010, 02:50 PM

Tags for this Thread

Posting Permissions

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