Is there a way to reference the name of a page in a tab control ?

  • Thread starter Thread starter Spidey3721
  • Start date Start date
S

Spidey3721

Wondering if there is a way to reference the name of a page in a tab index
on a form. I want to use it in an expression to manipulate that pages
content...
 
Spidey3721 said:
Wondering if there is a way to reference the name of a page in a tab
index on a form. I want to use it in an expression to manipulate that
pages content...

Certainly if you have a reference to the page or the index of the page,
you can get the name of the page. For example:

?Forms!frmTabbedForm!tabMyTab.Pages(0).Name
Page1
?Forms!frmTabbedForm!tabMyTab.Pages(1).Name
Page2

I'm not sure where you're coming from with this question, so I can't
give you more specific help.
 
Individual tabs on a TabControl are actually Pages. They are members of the
Pages collection for that TabControl and can be accessed via standard means:
'myTab.Pages("pagename")' or 'myTab.Pages(index)'

Keep in mind that either 'myTab.Value' or simply 'MyTab' will return the
Index number of the current Page.

Therefore, 'myTab.Pages(myTab)' refers to the current page.
Similarly, 'myTab.Pages(myTab).Name' returns the Name of the current page.
 
Does myTab only work in VB ?

I tried to test it out by trying to get a textbox on my tabcontrol to return
the name (or even the value) of the current tab - I cannot seem to do this
with a simple controlsource expression :

=mytab.pages(mytab).Name


My goal is to try to use a single subform for every controltab page and to
have the subform's record source expression look to the tabname in order to
determine it's record source. My tabs are named such that I can work them
into a query string to refer to different tables...
 
Given: a TabControl named tabTest on a Form named frmTest

Using following as the ControlSource for a Textbox on the Tabcontrol
returned the index value of the current selected page/tab. Note: I
specifically had to requery the textbox when I changed pages in order for
the new value to appear.

=Forms("frmTest").[tabTest]

The following returned the name of the page:
=Forms("frmTest").[tabTest].[Pages](Forms("frmTest").[tabTest]).[Name]

Hope this helps,
 
Back
Top