Help with calculations with an unspecified # of records

L

LynneMc

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]")
 
L

LynneMc

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]")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top