Tabs visible, not visible on form load

R

Ryis

Hello,

I have 3 different types of permission levels for my database, when a form
loads i want only certain tabs to show up depending on the permission level,
this is what i have so far which works strictly for "SUPER ADMIN", how do
tell the form if the permission level ="MANAGER" to make 2 or 3 of the now
hidden tabs visible again.

Private Sub Form_Load()
If Forms!SIGNIN.LOGINBACK_subform.Form.PERMISSION_LEVEL <> "SUPER ADMIN" Then
Me.EMPLOYEES_TAB.Visible = False
Me.PO_LOG.Visible = False
Me.REPORTS.Visible = False
Me.EMPLOYEES_TAB.Visible = False
Me.INCEDENT_ACCIDENT_NVESTIGATION.Visible = False
Me.INTERNAL_AUDITS.Visible = False
End If
End Sub

Any help would be appreciated

Ryan
 
A

Arvin Meyer [MVP]

Try:

Private Sub Form_Load()
Select Case Forms!SIGNIN.LOGINBACK_subform.Form.PERMISSION_LEVEL

Case Is "MANAGER"
Me.EMPLOYEES_TAB.Visible = False
Me.PO_LOG.Visible = False
Me.REPORTS.Visible = False
Me.EMPLOYEES_TAB.Visible = False
Me.INCEDENT_ACCIDENT_NVESTIGATION.Visible = False
Me.INTERNAL_AUDITS.Visible = False

Case Is "SUPER ADMIN"
Me.EMPLOYEES_TAB.Visible = True
Me.PO_LOG.Visible = True
Me.REPORTS.Visible = True
Me.EMPLOYEES_TAB.Visible = True
Me.INCEDENT_ACCIDENT_NVESTIGATION.Visible = True
Me.INTERNAL_AUDITS.Visible = True

Case Else

End Select
End Sub
 
B

Beetle

You could use a Select Case statement, i.e.;

Private Sub Form_Load()

Dim strPermLevel As String

strPermLevel = Forms!SIGNIN.LOGINBACK_subform.Form!PERMISSION_LEVEL

Select Case strPermLevel
Case "PEON"
Me.EMPLOYEES_TAB.Visible = False
Me.PO_LOG.Visible = False
Me.REPORTS.Visible = False
Me.EMPLOYEES_TAB.Visible = False
Me.INCEDENT_ACCIDENT_NVESTIGATION.Visible = False
Me.INTERNAL_AUDITS.Visible = False
Case "MANAGER"
Me.EMPLOYEES_TAB.Visible = False
Me.PO_LOG.Visible = False
Me.REPORTS.Visible = True
Me.EMPLOYEES_TAB.Visible = False
Me.INCEDENT_ACCIDENT_NVESTIGATION.Visible = True
Me.INTERNAL_AUDITS.Visible = True
Case "SUPER ADMIN"
Me.EMPLOYEES_TAB.Visible = True
Me.PO_LOG.Visible = True
Me.REPORTS.Visible = True
Me.EMPLOYEES_TAB.Visible = True
Me.INCEDENT_ACCIDENT_NVESTIGATION.Visible = True
Me.INTERNAL_AUDITS.Visible = True
End Select


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top