View Single Post
  #8  
Old May 13th, 2010, 02:49 PM posted to microsoft.public.access.tablesdbdesign
Doctor
external usenet poster
 
Posts: 75
Default Cross References Help

I thought about that. But didn't end up doing that because I didn't think
that a form based on a union query would be updateable.

It seems like my best option at this point is to create two subforms. One
for entering new cross references, and another one based on a union query for
displaying them.

Is this a good way to do this?

"John W. Vinson" wrote:

On Wed, 12 May 2010 07:36:01 -0700, Doctor
wrote:

I'm sure this question has an easy answer. Just can't figure it out on my own.

How do I design a situation where I can have multiple cross-references
created for my records?

My current setup:
tblResources
-ResourceID
-ResourceText

tblCrossReferences
-ParentResourceID
-ChildResourceID

I have a many to many relationship. But here is where it falls apart.

If I am on record 1 and I create cross references to records 2, 3, and 4 in
the cross references subform, then I navigate on the main form to record 2, I
want to be able to see the cross reference linking records 1 and 2. But since
the sfrmCrossReferences is linked to the ParentResourceID, it doesn't show
that these two resources have been linked when I am on record 2.

Is there a way to show this?

Any help would sure be greatly appreciated.


You may need to join the crossref table both ways and use a UNION query to
combine them:

SELECT A.ResourceText, B.ResourceText
FROM (tblResources AS A Inner Join tblCrossReferences
ON tblCrossReferences.ParentResourceID = A.ResourceID)
INNER JOIN tblResources AS B ON B.ResourceID =
tblCrossReferences.ChildResourceID
UNION
SELECT A.ResourceText, B.ResourceText
FROM (tblResources AS A Inner Join tblCrossReferences
ON tblCrossReferences.ChildResourceID = A.ResourceID)
INNER JOIN tblResources AS B ON B.ResourceID =
tblCrossReferences.ParentResourceID
--

John W. Vinson [MVP]
.