Tab Controls and SubForms

  • Thread starter Thread starter Kathie G via AccessMonster.com
  • Start date Start date
K

Kathie G via AccessMonster.com

Hello all,
I have a Main form that is showing information such as agency, agency sites,
contacts, etc. in a tab control (tabctrl1), the 2nd tab (tab2sites) should
not be able to be clicked if a checkbox of "multiple sites" (cbxMS) on the
form (frmprov_info) on the Agency tab (tab1agency) is not checked. How is
the best way to achieve this? I tried multiple things but am having no luck.

Thanks for your help. :)
 
You can disable a tab page which still allows it to be clicked but disables
all the controls on the page. You would do this by setting the Enabled
property of the page to false. For example, in the AfterUpdate event of
cbxMS on the main form:

if me.cbxMS then
me.tab2sites.enabled = true
else
me.tab2sites.enabled=false
endif

A shorter way of doing this is as follows:

me.tab2sites.enabled=me.cbxMS

The only other method I can think of is to toggle the visible property of
the tab page - however I'm not sure that you will like having this tab page
pop in and out of view. You can try it by using the same code substituting
"Visible" for "Enabled"

Note that anything you do in the AfterUpdate event of the cbxMS control you
also need to do in the Current event of the form so that you will reset the
property for new and existing records after record navigation.
 
Back
Top