Calculate Days Between Records

Worked for me? :(

1739702551737.png


Perhaps due to your date delimiters?

If I use yours I get.
1739702681727.png


So change the code to match your date format. :(
Could try a universal format?
Code:
SELECT tblPayment.PaymentID, tblPayment.PaymentDate, DMax("PaymentDate","tblPayment","PaymentDate < #" & Format$([PaymentDate],"yyyy-mm-dd") & "#") AS PrevPaymentDate, Nz(DateDiff("d",DMax("PaymentDate","tblPayment","PaymentDate < #" & Format$([PaymentDate],"yyyy-mm-dd") & "#"),[PaymentDate]),0) AS [Difference(days)]
FROM tblPayment;
 

Users who are viewing this thread

Back
Top Bottom