I have the following table :
tCustomerOrder
-IdOrder
-IdCustomer
-OrderDate
I want a query to get a table with :
-Idcustomer
-LastOrder_date
-LastOrder_Id
-LastOrder_period ''ie elasped time between the two last orders
-NextOrder_Date ''estimated date egal to LastOrder_date + LastOrder_period
I success to have LastOrder_Date (using MaxDom function to calculate a new fied) but when I use DiffDate it return en error.
LastOrder_Date: MaxDom("OrderDate";""tCustomerOrder"";"[IdCustomer]=" [IdCustomer] & " AND [IdOrder]<>" & [IdOrder] & " AND [OrderDate] < " & [OrderDate])
DiffDate("\d";[tCustomerOrder];[LastOrderDate])
Must I have to use aggregate query? How do it work? Thanks a lot for your support.