Marcus,
Yes, triggers are strange beasts.
The only thing you know when a trigger fires is (1) that you are on the table, the alias you do not know but CursorGetProp('SourceName') returns the tablename and (2) you are on the record
They do reopen the tables with another alias. In fact, they have to do that since they mustn't change record pointers of your aliasses.
Also, when a trigger is fired for an alias, you cannot change the record pointer in that alias, ie you cannot move off that record until the trigger exits
You can learn a lot looking at the code the RI builders generate
Happy triggering
>Gregory,
>
>thanks for you answer. We finally found the problem. We tried to pick up the PK of the table alias (Lets call the Table and Alias MARCUS)
>
>Actually we used lcPK = MARCUS.PK_Marcus ...
>
>That caused all problems. When we have cascaded delete the table is not opened with the alias MARCUS!
>Ends up to:
>
>lcPKWrong = MARCUS.PK_Marcus (gets any PK, wherever we left the table MARCUS)
>lcPKRight = PK_Marcus (always the PK of the right recod )
>
>After working a bit of time on this problem we seem to have lost the right focus of looking to it and I really searched is the totally wrong direction...
>
>Marcus
>
>>>If I delete the according record in Table1 my Table3-Code fires, but the record pointer of table3 stands anywhere? So I can't find out wich record is planed to be deleted, so I can't perform my action!
>
>
>>When the trigger of table3 fires, you
are on the record of table3 that is being deleted. It does not matter which table (1 or 2) initiated it.
>>Actually, deleting a record in table1 will start deleting records in table2. Then Table2 RI is fired, which deletes a record in table3. So it is always table2 that initiates the trigger
>>
>>Also, the trigger fires for each record of table3 that is being deleted. When the code of table3 is fired, you are on the record that is about to be deleted.
Gregory