Creating a login RRS feed

  • Question

  • User-769911344 posted


    I am working on building a database within MS Access which all the internals are complete but I require a login page to make it secure and only access the appropriate screens/ pages/ forms (due to the different levels of sensitive information within)

    I currently have a login page which is working great, but because I am using this within my work place I can not use it straight from the relationship I have setup (the users table) Here is the code I have currently:

    Private Sub Command25_Click()
    If Len(Me.Username & "") <> 0 And Len(Me.Reference & "") <> 0 Then        '-- There is an entry in the UserName and password
         If StrComp(DLookup("Reference", "Users", "Username = '" & Username & "'"), Reference, 0) = 0 Then
                '-- Password for this UserName is valid
                   If Username = "administrator" Then
                        DoCmd.OpenForm "Splash"
                   ElseIf Username = "manager" Then
                        DoCmd.OpenForm "Splash Manager"
                   ElseIf Username = "sped" Then
                        DoCmd.OpenForm "Splash Sp Ed"
                   ElseIf Username = "ssor" Then
                        DoCmd.OpenForm "Splash SSO R"
                   ElseIf Username = "sso" Then
                        DoCmd.OpenForm "Splash SSO"
                        MsgBox "Your Username and/or does not correspond", 16, "Invalid Attempt"
                   End If
                MsgBox "Invalid Username and/or Password. Try Again.", 16, "Invalid Attempt"
          End If
          MsgBox "Please either re-enter a User Name or Password", 16, "Missing User Name"
    End If
    End Sub

    I have 3 tables which I have setup - which are required to reflect upon the login:


    ID, Username, Reference


    ID, Descriptions


    ID, User ID, Group ID

    I am not allowed to have a dirrect relationship within my code to the user table, but I need to get the information from tbl_GroupMembers which only holds/ contains numbers relating to the appropriate Group ID (tbl_Groups) and User ID (Users).

    My reference within Users needs to be a Hash - I currently have not done this, just to ensure I have got everything working first then I'll Hash my code.

    Can you please help?

    Monday, October 7, 2013 8:58 PM


  • User-734925760 posted


    According to your description, I suggest to create a table, it will contain GroupId and AccessPage.

    We can create a procedure, then we can get GroupId and AccessPage by UserID. As we login, we will know which page we should direct to.

    There is a thread about loging with roles, please refer to the link below:


    Hope it’s useful for you.

    Best Regards,

    Michelle Ge

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 8, 2013 10:17 PM