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
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