Subform question !?!

  • Thread starter Thread starter David
  • Start date Start date
D

David

I have three tables, lets call them A, B and C. A to B is
one-to-many and B to C is one-to-many.

I have a tabbed form (representing a selected table A
record) to do updates to A and B. The update to B is done
via a scrolling subform.

Now I want to create a subform on a new tab for viewing of
table C records relating to the table A record. There is
not a direct relation, they are related via table B.

I want this subform to show all table C records related to
table A via table B. No updates will be possible, this
will be viewing only.

What is the easiest way to do this?
 
Hi,


Add the subform C to the main form, edit its parent/child link to make its
parent associated to:

FORMS!FormA!ControlNameOfSubformB.FORM!ControlInFormBUsedAsParent


Forms and Form are keyword (all cap above), replace other names with the
appropriate ones in your case.


Hoping it may help,
Vanderghast, Access MVP
 
Thanks for the input.
But I'm confused about your answer.
What is 'ControlInFormBUsedAsParent' ?
Does that have to be the primary key?
So do I have to create an invisible control for it?
Form B is a continuous form but does not contain the
primary key as a control.
 
Hi,




ControlInFormBUsedAsParent is the control name in formB that gets the data
value that is "linking" the formC data to be displayed to the actual formB
record in focus...




Hoping it may help,
Vanderghast, Access MVP
 
I am sorry but now I am more confused.
I am not sure you understand what I want.

Let me explain further. I have Projects (table a),
Assignments (table a) and Comments (table c)
Assuming my main form is positioned on a given Project,
Subform B shows all Assignments for the Project. Subform C
must show all comments for the Project NOT all comments
for a selected Assignment.
So I am totally confused as to why I need refer to a
control in subform B. I have a query that gets exactlty
the records I want (took me 5 mins to write), but I've
been stuck for 4 hours on what to put in the child and
master links to make this work.
 
Hi,


You probably mean Assignments is table B. Well, that is simpler in that
case and I am surprised Access does not find the matching fields,
automatically. Since table C is exactly like table B, as far as the RELATION
between it and tableA, the Parent Link should be the same, let say
ProjectID. The Child link in table C should be the field that match the
TableA.ProjectID. Now, why there is a problem is not evident to me. Am I
right in saying that TableB is totally irrelevant to the discussion?



Or is it that TableC is NOT DIRECTLY linked to tableA, but only
INDIRECTLY, through tableB? In that last case, use a query (otherwise what
follow makes no sense), to make implicit the relations, such as


SELECT c.*, b.ProjectID As AssociatedProject
FROM ( c INNER JOIN b ON c.whatever=b.IdontKnow) INNER JOIN a ON
b.ProjectID=a.ProjectID


and then, your link between table A and that QUERY ( not table C directly,
but that query) will become TableA.ProjectID and
QueryName.AssociatedProject. Note that I assume there is a relation between
C and B ( through their fields: c.whatever = b.IdontKnow )



Still not sure I understand the problem...
Vanderghast, Access MVP
 
Back
Top