Good morning,
I have an Access form with multiple tabs or pages, on one field value is basically the department or position of an employee. There are 4 positions. I am trying to make certain pages visible based on the position selected.
I have tried a few different versions of the below code in visual basic for the form. It works if there is only one IF and Else, but once I tried it with 4 different criteria it doesn't work. I am guessing it reads the first few lines and then throws the debug when executing the next IF.
Here is my code:
I have an Access form with multiple tabs or pages, on one field value is basically the department or position of an employee. There are 4 positions. I am trying to make certain pages visible based on the position selected.
I have tried a few different versions of the below code in visual basic for the form. It works if there is only one IF and Else, but once I tried it with 4 different criteria it doesn't work. I am guessing it reads the first few lines and then throws the debug when executing the next IF.
Here is my code:
VBA Code:
Private Sub Form_Current()
'If Department = "QC" Then
'Page5.Visible = False
'Page6.Visible = False
'Else
'End If
'If Department = "QC R/F" Then
'Page1.Visible = False
'Page2.Visible = False
'Page3.Visible = False
'Page4.Visible = False
'Page6.Visible = False
'Else
'End If
'If Department = "QA" Then
'Page1.Visible = False
'Page2.Visible = False
'Page3.Visible = False
'Page4.Visible = False
'Page5.Visible = False
'Else
'End If
'If Department = "DC" Then
'Page1.Visible = False
'Page2.Visible = False
'Page3.Visible = False
'Page4.Visible = False
'Page5.Visible = False
'Else
'End If
End Sub