Last post Oct 08, 2013 10:17 PM by Michelle Ge - MSFT
Oct 07, 2013 08:58 PM|pab15|LINK
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
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"
MsgBox "Invalid Username and/or Password. Try Again.", 16, "Invalid Attempt"
MsgBox "Please either re-enter a User Name or Password", 16, "Missing User Name"
I have 3 tables which I have setup - which are required to reflect upon the login:
ID, Username, Reference
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?
Oct 08, 2013 10:17 PM|Michelle Ge - MSFT|LINK
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.