Can I place a Tab Ctrl inside a Tab Ctrl?

  • Thread starter Thread starter Bill MItchell
  • Start date Start date
Doesn't a subform have to be based on another table with a
one-to-many relationship.
What is the tabbed control represents data in the same
table, is it still possible?
 
David said:
Doesn't a subform have to be based on another table with a
one-to-many relationship.

No, it can be unbound completely or bound to the same table (with caveats).
What is the tabbed control represents data in the same
table, is it still possible?

If a sub-form and it's parent are both bound to the same table my
experience is that you get a lot of write conflicts. As far as Access is
concerned it is the same as two different users editing the record at the
same time.

This can be done without a subform but it can make things difficult in
design view. You can initially place the second TabControl below the other
TabControl while working on it. Once you get everything working, you can
then move the second TabControl to the desired position "over" the first
TabControl. Then you add code to the Change event of the first TabControl
which hides the second TabControl for all TabControl_1 tab pages except
one.

In normal view this will give the appearance that the second TabControl is
embedded on a page of the first TabControl. However if you need to do
further work on the form later on, design view will be muddled up because
the second TabControl will always be visible and often "in the way". Once
the form is stable and not being modified a lot it is not a big deal.
 
I'm afraid you totally lost me....
Basically, I need a tabbed control within a tabbed control.
I have a lot of data and a lot of big memo fields and all
have to be subdivided into form sections.
Somone told me I could put the inner tab control in a
subform and I'm trying to find out how to do it in laymans
terms. Or, if anyone can come up with another creative
solution? Surely I'm not the only person ever to have
encountered this problem.
 
David said:
I'm afraid you totally lost me....
Basically, I need a tabbed control within a tabbed control.
I have a lot of data and a lot of big memo fields and all
have to be subdivided into form sections.
Somone told me I could put the inner tab control in a
subform and I'm trying to find out how to do it in laymans
terms.

I'll try again :-)

You can place a subform control on a page of a TabControl. If the form
that is referenced by the subform control happens to be a form that also
has a TabControl on it then when the parent form is viewed, you will see
what looks like a TabControl inside of another TabControl.

The problem with the above is that if you want both the parent form and the
subform to be bound to the same table you will likely get error messages
telling you that "another user has changed this record since you started
editing it...". This is a problem unrelated to the use of TabControls.
Access just doesn't like you to use two different forms to edit a record at
the same time.
Or, if anyone can come up with another creative
solution? Surely I'm not the only person ever to have
encountered this problem.

The alternative that I did a bad job explaining is to go ahead and use two
TabControls without the use of a subform. You are correct that the second
TabControl merely ends up "in front of" the first and is not actually
inside a particular page on the first TabControl. However; if you use code
in the Change event of the first TabControl that hides the second
TabControl except for when the first TabControl is on a particular page,
then it will "appear" as if the second TabControl is embedded on a page of
the first.

EXAMPLE:
If I only want to see the second TabControl when I am on the first page of
the first TabControl I would have code similar to this in the first
TabControl's Change event.

If Me!FirstTabControlName.Value = 0 Then
Me!SecondTabControlName.Visible = True
Else
Me!SecondTabControlName.Visible = False
End If

This could be shortened to...

Me!SecondTabControlName.Visible = (Me!FirstTabControlName.Value = 0)

The problem with the above strategy is that the second TabControl is
*always* visible while you are in design view. When you need to manipulate
objects on the first TabControl that are not on page one, the second
TabControl is obscuring your view. If you don't mind having to temporarily
move it out of the way and then putting it back, then it's no big deal.
 
Back
Top