Subject Re: [IBO] Keysource & Master Relationships Problem
Author Bob
> I hope you can see how the cross-linked relationships are causing this
> snafu. Applying values to ticket from the selected Booking row is no
> problem. If there is a forced 1:1 relationship between Lading and
Booking,
> as seems apparent, then don't Keylink Lading to Ticket. Put it in a Combo
> (not a LookupCombo) and use it as a selector for a Booking structure which
> joins Lading and Booking and supplies the values to Ticket. You can then
> masterlink this joined structure to Ticket through its Lading_ID.

I don't *exactly* see how they're causing my problems, though I do see that
I have a confusing setup. How about this: I've eliminated the M/D between
Lading and Booking and replaced it with a join (see below). I left the
LookupCombo attached between Ticket and Lading/Booking (tied on LADING_ID)
so the user can select a Lading (and its associated Booking).

SELECT L.LADING_NUM
, L.LADING_DATE
, L.LADING_ID
, L.BOOK_ID
, B.CARRIER
, B.ORIG_ID
, B.DEST_ID
, B.O_CONT_ID
, B.D_CONT_ID
, B.COMM_ID
, B.RATE
, B.UNIT
FROM LADING L JOIN BOOKING B
ON L.BOOK_ID = B.BOOK_ID

This works fine except for one thing, and that's the part I don't
understand. This works as long as I do not have the assignment between
Booking and Ticket in the LookupCombo OnChange event. I understand you've
said that that's the wrong place to put that code anyway. Where should I put
it? I've messed with the OnDataChange event of Ticket's datasource but can't
make it work (and I'm not sure that's the right place anyway).
This is the code I want to run when the user selects a Lading.

qrTicket['RATE'] := qrLading['RATE'];
qrTicket['UNIT'] := qrLading['UNIT'];
if PurchSale.ItemIndex = 0 then begin
qrTicket['CONT_ID'] := qrLading['O_CONT_ID'];
qrTicket['CUST_ID'] := qrLading['ORIG_ID'];
end else begin
qrTicket['CONT_ID'] := qrLading['D_CONT_ID'];
qrTicket['CUST_ID'] := qrLading['DEST_ID'];

Thanks again.

Bob.