jdcallejas
Registered User.
- Local time
- Today, 11:19
- Joined
- Jul 1, 2008
- Messages
- 108
Hello,
I am trying to update a field and I am having a hard time doing it.
I have two tables, tblInvoices and tblPmtDetails. I need to update the field InvPmt on the Invoices with the Sum amount of payments in tblPmtDetails "Field name AmountPmt" for that specific Invoice.
I have this done on my update query:
UPDATE Invoices RIGHT JOIN PmtDetail ON Invoices.InvID = PmtDetail.InvID SET Invoices.InvPmt = DSum("[AmountPmt]","PmtDetail","[InvID]=" & [InvID]);
Right now what it does is that it only updates the first record on the TblInvoices with the total amount of all payments.
So I have three invoices with $500 each and three payments with $500 each, what it does is adds all payments to $1500 and it puts all the amount on the first record of the Invoice table.
The problem is that is not selecting each Invoice Id for each reletaed record on the PmtDetail table.
Hope this makes sence...
Daniel
I am trying to update a field and I am having a hard time doing it.
I have two tables, tblInvoices and tblPmtDetails. I need to update the field InvPmt on the Invoices with the Sum amount of payments in tblPmtDetails "Field name AmountPmt" for that specific Invoice.
I have this done on my update query:
UPDATE Invoices RIGHT JOIN PmtDetail ON Invoices.InvID = PmtDetail.InvID SET Invoices.InvPmt = DSum("[AmountPmt]","PmtDetail","[InvID]=" & [InvID]);
Right now what it does is that it only updates the first record on the TblInvoices with the total amount of all payments.
So I have three invoices with $500 each and three payments with $500 each, what it does is adds all payments to $1500 and it puts all the amount on the first record of the Invoice table.
The problem is that is not selecting each Invoice Id for each reletaed record on the PmtDetail table.
Hope this makes sence...
Daniel