Hello.
Let me try to explain my problem!
TableA -> Id_A, Total_A
TableB -> Id_A, Id_B, Total_B
Both tables have triggers for insert, update and delete. My problem is in Table_B, that calls the function TableB_Trigger for Insert, Update and Delete.
Function TableB_Trigger
m.Id_A = TableB.Id_A
m.Id_B = TableB.Id_B
Select Sum(Total_B) From TableB Where Id_B = m.Id_B Into Array Total_A
m.Total_A = Iif(Type("Total_A[1]")#"N",0,Total_A[1])
Update Table_A Where Id_A = m.Id_A Set Total_A = m.Total_A
Ok. The code works fine, but the results doesn't!
If I open the Table_B (Use) and change the value of field Total_B (from 10 to 50), my trigger is fired and the code returns Total_A = 10 ... and it should be 50, ok?
I think the Select Sum(Total_B) is taking the "old value" in the table... because VFP doesn't know if that transaction will complete or won't.
I just want to calculate this total and put it in other table...
Do you have some "magic potion" to fix it?
TIA! TIA! TIA!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Rodolfo Duarte