Linking Subform to Subform

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

I want to build a page on a form called AllMatters on
which, by way of a subform, I can "lookup" Assets from a
table/query named AllAssets and thereby link the Assets
to particular matters via a junction table called
AssetDetails, which has the combined primary keys of
AllMatters (AllMattersID) and AllAssets (AllAssetsID) as
its primary key. (Up to here, I seem to have been
successful, using a subform I'll call
AssetLookupSubForm.) I want the AssetLookupSubForm in
datasheet form (or as a continuous form fashioned to look
like a datasheetform). On the same page, either via a
separate, side-by-side subform or via a form within the
AssetLookupSubForm, I want to allow for the input and
display of details regarding the currently selected
AssetLookupSubForm record. (I'll call this second
subform, AssetInformation-I want it to be in single form
view.) I have tried everything I can think of, to no
avail. If I try the subform within a subform approach,
and set the default view of AssetLookupSubForm to
datasheet, the AssetInformation subform does not appear.
If there is a way to make it appear, my problem may be
solved. If not, then I guess I must go with side-by-side
subforms, with the AssetInformation subform somehow
linked to the AssetLookupSubForm, so that when I choose a
new record in AssetLookupSubForm, the AssetInformation
subform will move to that record. I have tried linking
the two forms via the child and master properties and
creating a macro, based upon the current record selected
in the AssetLookupSubForm subform, but nothing has
worked. It is likely that one of these methods will
work, but I'm simply doing something wrong. Is there a
way via one of the above-referenced methods or some other
method to accomplish what I am attempting?

Thank you in advance.

Jim
 
I found the answer to my question by doing a Google
advanced search at:
http://groups.google.com/advanced_group_search

using this group (microsoft.public.access.forms) as the
newsgroup parameter and searching on the terms "link"
and "subform". There is a great deal of material,
presumably generated by the same folks who currently are
so generous with their input at this site. One entry was
as follows:

"Yes, it's possible. Make sure there's a text box
(visible or not) on
each of the subforms that is bound to the linking field.
Then put a
text box on the main form with its controlsource set to
an expression
that refers to the link field's text box on the subform
control that
will be the "driver" for this pair of subforms. For
example, if
you're linking on ClientID, the main form's text box
might be named
"txtLinkClient" and have this controlsource:

=[Subform1].[Form]![ClientID]

Then set this text box, txtLinkClient, as the Link Master
Field for
the second subform.

Note that, in the controlsource expression
above, "Subform1" is the
name of the subform *control*, which may or may not be
the name of the
form object it displays.
 
Back
Top