Adding one to one-to-many relationship

  • Thread starter Thread starter RipperT
  • Start date Start date
R

RipperT

How do I add records to the 'one' side of a one to many relationship if the
'many' side records already exist? I have to get the primary key value from
the 'one' record into the foreign key value of multiple 'many' records.
What's the best way to accomplish this through forms?
Thanks for any help.
Rip
 
How do I add records to the 'one' side of a one to many relationship if the
'many' side records already exist? I have to get the primary key value from
the 'one' record into the foreign key value of multiple 'many' records.
What's the best way to accomplish this through forms?
Thanks for any help.
Rip

How can you identify WHICH existing many-side records are related to the
record you're adding? This is backwards of the usual situation: a parent can
have children, but ordinarily a child doesn't create her own parent!

Could you explain the real-life context here?
 
Sure. The 'many' side of this relationship is already the many side of
another one-to-many, as you rightly expect.

tblHearings.HearingID (one) into tblCharges.HearingID (many)
tblSegregation.SegID (one) into tblCharges.SegID (many)

There can be several charges heard in one hearing. Later, a charged
individual can be classified to segregation based on several heard charges,
not nessesarily from the same hearing.

Thanks for the response.

Rip
 
Sure. The 'many' side of this relationship is already the many side of
another one-to-many, as you rightly expect.

tblHearings.HearingID (one) into tblCharges.HearingID (many)
tblSegregation.SegID (one) into tblCharges.SegID (many)

There can be several charges heard in one hearing. Later, a charged
individual can be classified to segregation based on several heard charges,
not nessesarily from the same hearing.


Well... that sounds like you still have an ambiguity. If there are several
heard charges from different hearings, how does that help you identify the
SegID for a given charge???

It sounds like you'll need to first create a record in tblSegregation, and
then (somehow, it's not clear to me how) identify a subset of the records in
tblCharges to that value. You surely can't have SegID's already specified in
tblCharges, at least not if you have referential integrity enforced!
 
Back
Top