i have two tables in Access; tblFiles and tblPayments. there can be many payments for each file; they are linked via tblFiles LEFT JOIN tblPayments ON tblFiles.fldFile_id = tblPayments.fldFileId.
in addition to fldFileId, tblPayments has fldPaymentDate and fldPaymentAmount
What i need (in the same recordset) is 1) the payment made most recently and 2) the sum of payments for each file. i have been dabbling with subqueries, MaxOf_fldPaymentDate and various permutations of self-joins for a couple of days, but no joy so far.
has anyone done anything similar in the past?
result sought, (eg file 19 has two payments - £400 in April this year and £500 previously:
[tt]
qryAllData
fldFile_id MaxOfDate LatestPaymentAmount SumOfPayments
019 04/04/03 £400.00 £900.00
020
021 01/01/01 £100.00 £100.00
022
[tt]
thanks
g
in addition to fldFileId, tblPayments has fldPaymentDate and fldPaymentAmount
What i need (in the same recordset) is 1) the payment made most recently and 2) the sum of payments for each file. i have been dabbling with subqueries, MaxOf_fldPaymentDate and various permutations of self-joins for a couple of days, but no joy so far.
has anyone done anything similar in the past?
result sought, (eg file 19 has two payments - £400 in April this year and £500 previously:
[tt]
qryAllData
fldFile_id MaxOfDate LatestPaymentAmount SumOfPayments
019 04/04/03 £400.00 £900.00
020
021 01/01/01 £100.00 £100.00
022
[tt]
thanks
g