An example of filtering certain forms or subform tabs (Me.TabControl.Pages(#)) for that matter based on user type. There is much more to this, I just chopped it down to make it reasonable. In this example there are three types of users "Admin" "Manager" "User", which each have their perks. I actually have more but they were not necessary to convey the concept here.
Private Sub Form_Load()
On Error Resume Next
Dim Permission As String
Permission = [Forms]![frmLogin]![txtPermissions].Value
If Permission = "Admin" Then
Me.Caption = "Admin View"
Me.TabControl.Pages(0).Visible = True
Me.TabControl.Pages(1).Visible = True
Me.TabControl.Pages(2).Visible = True
Me.TabControl.Pages(3).Visible = True
Me!txtCaseNum.Visible = True
Me!txtStaffNum.Visible = True
[frmCase].[Form]![txtAssignStaff].Visible = True
[frmCase].[Form]![AssignStaffHighlight].Visible = True
ElseIf Permission = "Manager" Then
Me.Caption = "Manager View"
Me.TabControl.Pages(0).Visible = True
Me.TabControl.Pages(1).Visible = True
Me.TabControl.Pages(2).Visible = True
Me.TabControl.Pages(3).Visible = False
Me!txtCaseNum.Visible = True
Me!txtStaffNum.Visible = True
[frmCase].[Form]![txtAssignStaff].Visible = True
[frmCase].[Form]![AssignStaffHighlight].Visible = True
ElseIf Permission = "User" Then
Me.Caption = "User View"
Me.TabControl.Pages(0).Visible = True
Me.TabControl.Pages(1).Visible = False
Me.TabControl.Pages(2).Visible = False
Me.TabControl.Pages(3).Visible = False
Me!txtCaseNum.Visible = True
Me!txtStaffNum.Visible = False
[frmCase].[Form]![txtAssignStaff].Visible = False
[frmCase].[Form]![AssignStaffHighlight].Visible = False
'Anyone with username and password attempting to access this form without a proper permission level set forces the application to shutdown without warning if they made it past login form with the following.
ElseIf Nz(Permission, "") = "" Or Nz(Permission, "") = 0 Then
Beep
'module that handles the logging
modSomeName.Tracker "Unauthorized Access Attempt - Permissions Null or 0"
DoCmd.Quit
ElseIf Permission <> "Admin" Or Permission <> "Manager" Or Permission <> "User" Then
Beep
'module that handles the logging
modSomeName.Tracker "Unauthorized Access Attempt - Permissions Not Recognized"
DoCmd.Quit
End If
'otherwise open the form/subforms and set all records to new/blank
DoCmd.GoToRecord , , acNewRec
End Sub