Help with calculations with an unspecified # of records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am new to Access & trying to create a field that will calculate the
"balance due", by taking the "TotalTripCost" and subtracting all the
"PaymentAmount"s. I can get it to subtract the first payment, but I can't
figure out how to make it account for additional payments (there are varying
numbers of PaymentAmount s for any given TripID, all stored in separate
Payments records). Is there anything that will make it "add up all the
paymentamounts for this TripID and subtract from TotalTripCost"? This is what
I have now:

=[TotalTripCost]-DLookUp("[PaymentAmount]","[Payments]","[TripID] =
Forms![Trips]![TripID]")
 
Thank you Ed, that worked!

Ed Warren said:
Look in Help under Dsum(), I think that is the function you want.

Ed Warren.


LynneMc said:
I am new to Access & trying to create a field that will calculate the
"balance due", by taking the "TotalTripCost" and subtracting all the
"PaymentAmount"s. I can get it to subtract the first payment, but I can't
figure out how to make it account for additional payments (there are
varying
numbers of PaymentAmount s for any given TripID, all stored in separate
Payments records). Is there anything that will make it "add up all the
paymentamounts for this TripID and subtract from TotalTripCost"? This is
what
I have now:

=[TotalTripCost]-DLookUp("[PaymentAmount]","[Payments]","[TripID] =
Forms![Trips]![TripID]")
 
Back
Top