User-769911344 posted
Hi,
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
Username.SetFocus
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"
Else
MsgBox "Your Username and/or does not correspond", 16, "Invalid Attempt"
End If
Else
MsgBox "Invalid Username and/or Password. Try Again.", 16, "Invalid Attempt"
Me.Username.SetFocus
End If
Else
MsgBox "Please either re-enter a User Name or Password", 16, "Missing User Name"
Me.Username.SetFocus
End If
End Sub
I have 3 tables which I have setup - which are required to reflect upon the login:
Users
ID, Username, Reference
tbl_Groups
ID, Descriptions
tbl_GroupMembers
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?