I have a database in Access 2003 that I only want certain people to be able to access. In my database I have a table which lists the people that should be able to access the da
This is the Access security window dressing I use.
Public Function SecurityCode()
'* Purpose: Limits access to program
Dim sUserID As String
Dim sUserName As String
'* Determines user from Windows Login
sUserID = Environ("USERNAME")
'* Lookup on BE table of Allowed Users to verify on the list.
sUserName = DLookup("[UserName]", "tbl_AllowedUsers", "ID = '" & sUserID & "'")
If Len(sUserName) > 0 Then
'Allowed User, opens Main Switchboard
'Set global variable for Admin rights
g_Admin = DLookup("[AdminRights]", "tbl_AllowedUsers", "ID = '" & sUserID & "'")
DoCmd.OpenForm "Switchboard"
DoCmd.SelectObject acForm, "Switchboard", True
DoCmd.RunCommand acCmdWindowHide
Else
'Not on the Allowed Users list, opens to a Password Page
DoCmd.OpenForm "frm_LockPage"
DoCmd.SelectObject acForm, "frm_LockPage", True
DoCmd.RunCommand acCmdWindowHide
End If
End Function