ms access - Iterate through tabs in TabControl to hide tabs based on names -
i working on microsoft access database (office 2010) , have tab control on bottom of form displays equipment information based on type of equipment select. trying make dynamically display , hide tabs determined name of tabs.
to accomplish have used following naming convention 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 called "tabs"
i have set form execute function below(the function need with) on form load , onchange of equipment drop down menu.
to call function use following code.
displaytab
here code far. have been googling bit , have yet find doing similar me , have found myself little lost on one. appreciated.
function displaytab(equipmenttype string) dim ctl control each ctl in me.tabs if ctl.name.contains("tab_static_") me.tabs.pages.item(ctl).visible = true elseif ctl.name.contains("tab_config_") if ctl.name.contains("tab_congig_" & equipmenttype) me.tabs.pages.item(ctl).visible = true else me.tabs.pages.item(ctl).visible = false end if else msgbox "there unusually named tab. please contact database adminsitrator." end if next ctl end function
the error getting "invalid qualifier" after googling message doesn't make sense.
if ctl.name.contains("tab_static_")
is not valid vba syntax. thinking of similar method might availabe in vb.net. in vba like
if instr(ctl.name, "tab_static_") > 0
Comments
Post a Comment