Child PAYMENTS table includes fields: PaymentDate, PaymentAmount
When a PAYMENT is inserted, the SumOfPayments should increase by PaymentAmount, and if Payment is deleted, SumOfPayments should decrease by that amount. Easy enough in a trigger. The problem comes in the MostRecent fields. I can create a TASK to reorder PAYMENT table entries by PaymentDate and then reset those fields in the LOAN table, and loop thru PaymentAmounts to recalculate SumOfPayments. But triggers occur mid-transaction, so too early to set the MostRecent fields, or do I misunderstand? I would like to run the task immediately after the insert/delete/update takes place. Is there any way to do this?
Also, in a tabular report that allows inline edit and where the results are ordered by PaymentDate, I do not see a reordering after editing/updating the Payment Date. If I reload the results, the order is correct, but not if I edit inline. Here is an example of the results after changing the first row's date to occur before the date in the second row.
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
skcombs
Situation: Parent LOAN table includes fields: Date, Amount, SumOfPayments, MostRecentPayment, MostRecentPaymentAmount
Child PAYMENTS table includes fields: PaymentDate, PaymentAmount
When a PAYMENT is inserted, the SumOfPayments should increase by PaymentAmount, and if Payment is deleted, SumOfPayments should decrease by that amount. Easy enough in a trigger. The problem comes in the MostRecent fields. I can create a TASK to reorder PAYMENT table entries by PaymentDate and then reset those fields in the LOAN table, and loop thru PaymentAmounts to recalculate SumOfPayments. But triggers occur mid-transaction, so too early to set the MostRecent fields, or do I misunderstand? I would like to run the task immediately after the insert/delete/update takes place. Is there any way to do this?
Also, in a tabular report that allows inline edit and where the results are ordered by PaymentDate, I do not see a reordering after editing/updating the Payment Date. If I reload the results, the order is correct, but not if I edit inline. Here is an example of the results after changing the first row's date to occur before the date in the second row.
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.