Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculations Access Query

Status
Not open for further replies.

Grieve1

Programmer
Jun 11, 2008
33
GB
I have a Payment Certificate Query Where the Fields "ThisPayment" and "LastPayment" are added together to produce "TotalPayment" but "LastPayment" is to be generated by previous "TotalPayment" which a Dlookup will get me but appears blank, probably something to do with circular reference but not generating that error.e.g.
TotalPayment LastPayment This Payment
20000 = 0 + 20000
50000 = 20000 + 30000
Any assistance or info telling me this is not possible on a query would be good. Thanks
 
Need a bit more detail.

Are "This Payment" and "LastPayment" in the same record?

Are you trying to do this in Code? In an SQL query?

Can you show us what you've done so far?
 
Yes they are in the same record, This payment you enter in each time last payment is the previous record total payment and total payment is made up from adding together this payment and last payment. What I expected was 1st record would contain nothing for last payment and total payment would be same as this payment. Second Record Last payment would display Previous Total Payment and Total payment would contain This payment plus pprevious total payment. Like a running total. I have just done a DLookup on last payment. e.g.DLookUp("[TotalPayment]","qryPayment Cert","[PaymentNumber]=" & [PaymentNumber]-1 & " AND [CompanyName]=""" & [CompanyName] & """").
 
Do you have a date field to go along with the payments. If so you could sum the values excluding the Max(PaymentDate) payment in a query.

Post additional table information so we can assist you with the query.
 
Yes I do have date field and tried doing a dlookup and DMax of date but wouldn't work. Not quite sure what you mean by Sum the values excluding the Max Date
 
Thank you all for your assistance working with the DSum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top