I've got VBA code written to make a hidden tab appear based on a combo box selection. There are seven options in the combo box that each corresponds to seven hidden tabs in the frame.
Private Sub CBO_EntryType_Change()
Dim iPage As Integer
If Me.CBO_EntryType.Value = "Abstracts" Then
iPage = 1
ElseIf CBO_EntryType.Value = "Awards" Then
iPage = 2
ElseIf CBO_EntryType.Value = "Career Fairs" Then
iPage = 3
ElseIf CBO_EntryType.Value = "Editorials" Then
iPage = 4
ElseIf CBO_EntryType.Value = "Rankings" Then
iPage = 5
ElseIf CBO_EntryType.Value = "Tradeshows" Then
iPage = 6
ElseIf CBO_EntryType.Value = "Social Media" Then
iPage = 7
End If
Me.MultiPage1.Pages(iPage).Visible = True
End Sub
What I seem to be having trouble with is, how do I make sure the other tabs are hidden? Since people can only click one option in the combo box, but they might click one by mistake, and then click the correct one. Only one tab should be visible based on the selected item in the combo box. The other six should be hidden.
I'm thinking a For-Each-Next loop at the end of the sub that disables any tab that doesn't match the iPage variable but I'm having difficulty figuring out how to address the frame and pages in the For Each Next loop. What would the variable declaration be?