I have a form with a tabbed control on it. I am trying to set certain criteria for some of the tabs to show only when info from other fields meet criteria.
Specifically, I have two fields. Both are combo boxes (using tables as the row source).
What I want is that when empType combo box is set to Prehire (8 in the table) AND the empPosition combo box is set to Police Officer then the Police_MSK tab is visible. But if both of those conditions aren't met then I don't want that tab showing.
What might complicate this is that for all other Prehires (non Police Officer's) I have a different tab that I want to be visible called Prehire_MSK.
Here is what my code looks like:
So after updating the empType field to Prehire I get the Prehire_MSK tab to show up and when I change that field to any other type the Prehire_MSK tab goes away like it's supposed to.
But it doesn't seem to be looking at the empPosition field and I can't get the Police_MSK tab to show up when it is a Prehire Police Officer. Can someone help me and tell me what's wrong with my code?
Am I better off using a Select Case instead of the If/Then/Else?
I hope I explained well enough what my problem is...
Thanks!
Specifically, I have two fields. Both are combo boxes (using tables as the row source).
What I want is that when empType combo box is set to Prehire (8 in the table) AND the empPosition combo box is set to Police Officer then the Police_MSK tab is visible. But if both of those conditions aren't met then I don't want that tab showing.
What might complicate this is that for all other Prehires (non Police Officer's) I have a different tab that I want to be visible called Prehire_MSK.
Here is what my code looks like:
Code:
Private Sub empType_AfterUpdate()
If Me.empType = "8" Then
Me.Prehire_MSK.Visible = True
Else
Me.Prehire_MSK.Visible = False
End If
If Me.empType = "8" And Me.empPosition = "Police Officer" Then
Me.Police_MSK.Visible = True
Else
Me.Police_MSK.Visible = False
End If
End Sub
But it doesn't seem to be looking at the empPosition field and I can't get the Police_MSK tab to show up when it is a Prehire Police Officer. Can someone help me and tell me what's wrong with my code?
Am I better off using a Select Case instead of the If/Then/Else?
I hope I explained well enough what my problem is...
Thanks!
Comment