This is my problem:
Table Invoice:
InvoiceId
CustomerID
Total_Invioce (Double)
Table Payments:
PaymentId
PaymentType
...
So, one payment can distributed in more than one invoice, and payments might be partial.
I created a table InvoiceVsPayment:
InvoiceID
PaymentID
PaymentPart: stores the portion of the payment that belongs to the invoice.
I have a sub-form(datasheet view) used to input the parts of the payments by Invoice. The source of the subform is a query that shows the InvoiceId, Total_invoice, and Payment part. The query works fine letting me update the paymentpart, however, I would like to show a running total of the payments already done to that specific invoice, so that I can calculate the remaining balance.
I tried the following approaches, with no success:
1. I tried with a query that will total payments by invoice (qry_total_payment), but if I include the query in the subform query, then I can't edit the fields in the form.
2. I created a field in the Invoice table, where I would store the sum of the payments from the other table. But I don't know how to update the field using qry_total_payment query. The update query in access does not let me use a "totals" query. Any ideas?
P.S. I know option 2 is not a good practice, but don't see another way around?
Table Invoice:
InvoiceId
CustomerID
Total_Invioce (Double)
Table Payments:
PaymentId
PaymentType
...
So, one payment can distributed in more than one invoice, and payments might be partial.
I created a table InvoiceVsPayment:
InvoiceID
PaymentID
PaymentPart: stores the portion of the payment that belongs to the invoice.
I have a sub-form(datasheet view) used to input the parts of the payments by Invoice. The source of the subform is a query that shows the InvoiceId, Total_invoice, and Payment part. The query works fine letting me update the paymentpart, however, I would like to show a running total of the payments already done to that specific invoice, so that I can calculate the remaining balance.
I tried the following approaches, with no success:
1. I tried with a query that will total payments by invoice (qry_total_payment), but if I include the query in the subform query, then I can't edit the fields in the form.
2. I created a field in the Invoice table, where I would store the sum of the payments from the other table. But I don't know how to update the field using qry_total_payment query. The update query in access does not let me use a "totals" query. Any ideas?
P.S. I know option 2 is not a good practice, but don't see another way around?