Three subforms, one two-tabbed control

  • Thread starter Thread starter amhouser
  • Start date Start date
A

amhouser

Hello,
I am having some issues with tab control. I am new to tab control and
so far cannot figure out what's going on.

Backstory: I have three subforms, UNLICENSED_subform, LICENSED_subform,
and STUTCH_SUPER_subform. Previously, they were on the form without tab
control. I had a nicely working script in which whether
UNLICENSED_subform or LICENSED_subform appeared, and whether the
STUTCH_SUPER_subform or a message appeared, depended on variable
"Licenseorno". It is as follows.

Private Sub Form_Current()
Select Case Me.LicenseorNo.Value

Case 0
Me.LICENSED_subform.Visible = False
Me.UNLICENSED_subform.Visible = False
Me.STUTCH_SUPER_subform.Visible = False
Me.UnsureTeachingLabel.Visible = True
Case 1
Me.LICENSED_subform.Visible = True
Me.UNLICENSED_subform.Visible = False
Me.STUTCH_SUPER_subform.Visible = True
Me.UnsureTeachingLabel.Visible = False
Case 2
Me.LICENSED_subform.Visible = False
Me.UNLICENSED_subform.Visible = True
Me.STUTCH_SUPER_subform.Visible = True
Me.UnsureTeachingLabel.Visible = False

End Select
End Sub

I threw the tab control in then and whamo my script stopped working
because it failed to recognize the subforms. So I deleted them, and
then proceeded to bind them to tab control. So far I have
LICENSED_subform bound to the first tab and when I tested the form
again I found that I didn't get a code error for all of them, as I had
before, only for the ones I hadn't yet put back in. Great! But the
problem is, when I go to bind UNLICENSED_subform onto the first tab as
well (same procedure as with LICENSED_subform, only I just lay
UNLICENSED_subform on top of it), it appears also on the second tab
(and LICENSED_subform does not). Is this because I have not completed
returning my subforms to the form, and so the code error is making
things behave weirdly? I really don't think so because in the design
view I can see that UNLICENSED_subform is attached to both tabs and
LICENSED_subform is not. (And obviously I'm not running code there so
the error isn't affecting that.) Am I missing something, or is it not
possible to put two subforms on one tab?

Thanks for any help in advance.
Harper
 
Hi,




IF you create a control on a tab page, and another control on another tab
page, YOU DON'T HAVE to do anything to hide/unhide them. Access will do it
for you.

IF you create a control outside the tab control and 'moved it' over the tab
control, the that control will always appear, independently of the "active"
tab. Select this method, or the previous one, to obtain the desired effect,
without having to write a single line of code.


Is that solve your problem? If not, please...You have to differentiate
between the CONTROL and the CONTENT. The control IS the subform, its content
is a FORM used inside the control. So the control, a container, can have a
name, and the content, another one. In fact, if you add twice a sub-form
control, you have to have two different sub-form control names, but we can
imagine they both display the same content, some form. In general, the
control and its content are the same, that is why there can be some
confusion, since using the same name for TWO different thing, well, is
ambiguous. Are you trying to hide a control using the name ... of what it
contains?


Hoping it may help,
Vanderghast, Access MVP
 
Back
Top