Question: In my Access table ORDERS, I have two objects, [CustomerID] and [OrderDate]. Each customer has many order dates and I am interested in doing analysis to determine the actual number of days between orders. I am looking for a solution that I can do in the QBE grid and would consider a procedure I can type in a module and use in the QBE.
So far I have used the suggestion to bring the same table in twice into my query and join on CustomerID. In my QBE, I have CustomerID; OrderDate from ORDERS; OrderDate from ORDERS_1; and DaysBetweenOrders: DateDiff("d",([ORDERS]![OrderDate]),([ORDERS_1]![OrderDate]))
Sample Table:
CustomerID OrderDate
1 3/24/04
1 5/3/04
1 9/20/04
My goal is to calculate the days between OrderDate 3/24/04 and 5/3/04 as well as 5/3/04 and 9/20/04. Some Customers have up to 10 order dates in one year.
Here is a sample of my results:
CustomerID Date1 Date2 Diff
1 3/23/04 5/3/04 41
1 3/23/04 9/20/04 181
1 5/3/04 9/20/04 140
It seems as though I have a extra calculation I do not need (the difference between 3/23/04 and 9/20/04). I'd appreciate any ideas and help.
Thank you in advance.
Thanks,
So far I have used the suggestion to bring the same table in twice into my query and join on CustomerID. In my QBE, I have CustomerID; OrderDate from ORDERS; OrderDate from ORDERS_1; and DaysBetweenOrders: DateDiff("d",([ORDERS]![OrderDate]),([ORDERS_1]![OrderDate]))
Sample Table:
CustomerID OrderDate
1 3/24/04
1 5/3/04
1 9/20/04
My goal is to calculate the days between OrderDate 3/24/04 and 5/3/04 as well as 5/3/04 and 9/20/04. Some Customers have up to 10 order dates in one year.
Here is a sample of my results:
CustomerID Date1 Date2 Diff
1 3/23/04 5/3/04 41
1 3/23/04 9/20/04 181
1 5/3/04 9/20/04 140
It seems as though I have a extra calculation I do not need (the difference between 3/23/04 and 9/20/04). I'd appreciate any ideas and help.
Thank you in advance.
Thanks,