I am working on a Microsoft Access Database (Office 2010) and I have a tab control on the bottom of my form that displays equipment information based on the type of equipment you select. I am trying to make it dynamically display and hide tabs as determined by the name of the tabs.
To accomplish this I have used the following naming convention for my tabs.
Tab_Static_Description
Tab_Static_Comments
Tab_Static_Maintenance
Tab_Config_Computer1
Tab_Config_Computer2
Tab_Config_Printer1
Tab_Config_Scanner1
Tab_Config_Telephone1
Tab_Config_Display1
My TabControl is called "Tabs"
I have set the form to execute the function below(the function i need help with) on form load and onchange of the equipment drop down menu.
To call the function i use the following code.
DisplayTab
Here is the code to far. I have been googling this a bit and I have yet to find someone doing something similar to me and have found myself a little lost on this one. Any help would be greatly appreciated.
Function DisplayTab(EquipmentType As String)
Dim Ctl As Control
For Each Ctl In Me.Tabs
If Ctl.Name.contains("Tab_Static_") Then
Me.Tabs.Pages.Item(Ctl).Visible = True
ElseIf Ctl.Name.contains("Tab_Config_") Then
If Ctl.Name.contains("Tab_Congig_" & EquipmentType) Then
Me.Tabs.Pages.Item(Ctl).Visible = True
Else
Me.Tabs.Pages.Item(Ctl).Visible = False
End If
Else
MsgBox "There is an unusually named tab. Please contact the database adminsitrator."
End If
Next Ctl
End Function
The error I am getting is "Invalid qualifier" but after googling that message it doesn't exactly make sense.