The Brown Growler
Registered User.
- Local time
- Today, 12:51
- Joined
- May 24, 2008
- Messages
- 85
Hi,
I am looking for a more eficcient way to rank some customer orders using the time of the order per day for the ranking. I can get it to rank OK in a query using an "Alias" option but for large record sets it takes hours and hours to run.
Is it possible to create a vba module to do this more efficiently via a custom ranking function or something similar? An example of what I wish to achieve is pasted below
table named t_orders, fields named [Date], [Customer],[OrderTime]
15/03/2012, Compaq, 09:45
15/03/2012, Compaq, 11:14
15/03/2012, Compaq, 16:30
15/03/2012, NEC, 09:20
15/03/2012, NEC, 10:10
15/03/2012, NEC, 15:40
18/03/2012, Compaq, 10:50
18/03/2012, Compaq, 12:42
18/03/2012, Compaq, 14:10
18/03/2012, NEC, 11:20
18/03/2012, NEC, 12:18
18/03/2012, NEC, 15:11
After the application of the ranking the [OrderRank] values are the rightmost figure on each line
15/03/2012, Compaq, 09:45 1
15/03/2012, Compaq, 11:14 2
15/03/2012, Compaq, 16:30 3
15/03/2012, NEC, 09:20 1
15/03/2012, NEC, 10:10 2
15/03/2012, NEC, 15:40 3
18/03/2012, Compaq, 10:50 1
18/03/2012, Compaq, 12:42 2
18/03/2012, Compaq, 14:10 3
18/03/2012, NEC, 11:20 1
18/03/2012, NEC, 12:18 2
18/03/2012, NEC, 15:11 3
The ranking is assigned on the basis of [OrderTime] per [Customer] on that [Date] with the earliest order assigned the value of 1 and increasing with subsequent orders per customer on that date.
Rgds
Growlos
I am looking for a more eficcient way to rank some customer orders using the time of the order per day for the ranking. I can get it to rank OK in a query using an "Alias" option but for large record sets it takes hours and hours to run.
Is it possible to create a vba module to do this more efficiently via a custom ranking function or something similar? An example of what I wish to achieve is pasted below
table named t_orders, fields named [Date], [Customer],[OrderTime]
15/03/2012, Compaq, 09:45
15/03/2012, Compaq, 11:14
15/03/2012, Compaq, 16:30
15/03/2012, NEC, 09:20
15/03/2012, NEC, 10:10
15/03/2012, NEC, 15:40
18/03/2012, Compaq, 10:50
18/03/2012, Compaq, 12:42
18/03/2012, Compaq, 14:10
18/03/2012, NEC, 11:20
18/03/2012, NEC, 12:18
18/03/2012, NEC, 15:11
After the application of the ranking the [OrderRank] values are the rightmost figure on each line
15/03/2012, Compaq, 09:45 1
15/03/2012, Compaq, 11:14 2
15/03/2012, Compaq, 16:30 3
15/03/2012, NEC, 09:20 1
15/03/2012, NEC, 10:10 2
15/03/2012, NEC, 15:40 3
18/03/2012, Compaq, 10:50 1
18/03/2012, Compaq, 12:42 2
18/03/2012, Compaq, 14:10 3
18/03/2012, NEC, 11:20 1
18/03/2012, NEC, 12:18 2
18/03/2012, NEC, 15:11 3
The ranking is assigned on the basis of [OrderTime] per [Customer] on that [Date] with the earliest order assigned the value of 1 and increasing with subsequent orders per customer on that date.
Rgds
Growlos