Okay, if your first 2 tabs do not use a subform, then the single generic
subform approach will not be suitable for this form (unless you can create
subforms for those 2 pages, which probably isn't your preferred design.)
Using different sized subforms is also an issue.
So, back to your original approach, with different subform controls on
different pages of the tab control. You can save the form with the
SourceObject property of the subforms left blank, and then assign the
property in the Change event of the subform if it has no already been
assigned:
With Me.[sbuPROMO]
If .SourceObject = vbNullString Then
.SourceObject = "F-PROMO"
End If
End With
and so on.
To answer your questions:
a) I would not deassign the SourceObject. Although it would save some
memory, you've already got the thing loaded, and the user is likely to come
back to the page.
b) When you assign the SourceObject, Access will have a guess at what you
need for LinkMasterFields/LinkChildFields. Just as at design time, it may
get it right (and if so it will probably be consistent) or it may not (in
which case you will need to assign the correct fields.)
c) There is no advantage in toggling the Visible property of the subform. It
doesn't show up anyway unless you are on that page, so it serves no purpose
to show/hide it.
HTH.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
<ApexData@gmail.comwrote in message
news:1172334921.826279.140950@s48g2000cws.googlegr oups.com...
Quote:
Quote:
>If you put the subform control on the form before adding the tab control,
>it
>is sitting directly on the form. You can also do it by selecting the
>subform
>control in the Toolbox, and clicking outside the tab control (i.e. on the
>form itself.)
>
Hate making excuses, but I can't seem to manipuate the control
(SendToBack) in such a way that it sits Totally behind the
TabControl. The problem is my first 2-Tabs DoNot use subForms, they
display txtBoxes of the MainForm. The new subForm Control that was
sent to the background keeps covering over this.
Also, I was Previously varying the size of the subForm Control on each
TabPage to suit my display requirement. I believe I lose that using
the single subForm control.
The concept is excellent, but unfortunately I'm too far into my app to
turn back time wise, but want to use this from the getgo on my next
venture.
>
If Your Inclined, I would really like to continue along the path I was
on (ie unique subForm control on each page, and assign the
SourceObject when selecting the Tab.
I'm too far into my app to turn back time wise.
>
I really appreciate all your advice :)
>
Would I need code to DeAssign the SourceObject when leaving the
Tab, I'm thinking the Table will stay open otherwise ???
>
Do I also need to use code to Assign the Child&Master Links, or can
I just type the names into the subForms Control Property and just
depend on the SourceObject to link to Table???
>
Do I need to toggle the subForms Visible property when entering and
leaving the tab??? I thought I read this somewhere?
>
Thanks Again Allen
Greg
>
>
>
>
>