454,962 Members | 1,240 Online
Need help? Post your question and get tips & solutions from a community of 454,962 IT Pros & Developers. It's quick & easy.

# Combinations in Access

9 Replies

 P: 62 Thanks for the reply, ADezii, I created code similar to yours to do exactly what you have there -- that is, cycle through each record within each grouping (though, your code seems more elegant than mine...) but the problem I'm having is basically this. Given 5 values: {1,2,3,4,5}, taken 2 at a time (A and B), how to I get out all the orders of those numbers? That is, I want the output of: A: 1 2 3 4 B: 5 A: 1 2 3 B: 4 5 A: 1 2 B: 3 4 5 A: 1 B: 2 3 4 5 A: 1 3 4 5 B: 2 A: 1 3 4 B: 2 5 A: 1 3 B: 2 4 5 A: 1 2 4 5 B: 3 A: 1 2 4 B: 3 5 A: 1 2 3 5 B: 4 The idea is that there is no difference between A and B ( so 1,2,3 :: 4, 5 is the same as 4,5 :: 1, 2, 3) But every combination of those 5 numbers is divided among A and B. Any help would be much appreciated. Thanks! Jan 24 '08 #3

 Expert 5K+ P: 8,679 Thanks for the reply, ADezii, I created code similar to yours to do exactly what you have there -- that is, cycle through each record within each grouping (though, your code seems more elegant than mine...) but the problem I'm having is basically this. Given 5 values: {1,2,3,4,5}, taken 2 at a time (A and B), how to I get out all the orders of those numbers? That is, I want the output of: A: 1 2 3 4 B: 5 A: 1 2 3 B: 4 5 A: 1 2 B: 3 4 5 A: 1 B: 2 3 4 5 A: 1 3 4 5 B: 2 A: 1 3 4 B: 2 5 A: 1 3 B: 2 4 5 A: 1 2 4 5 B: 3 A: 1 2 4 B: 3 5 A: 1 2 3 5 B: 4 The idea is that there is no difference between A and B ( so 1,2,3 :: 4, 5 is the same as 4,5 :: 1, 2, 3) But every combination of those 5 numbers is divided among A and B. Any help would be much appreciated. Thanks! I'll get back to you on this and see if I can come up with something. Jan 24 '08 #4

 P: 62 I'll get back to you on this and see if I can come up with something. Thanks! I've been thinking about it, and it may turn out to be easier to use a bunch of completion flags (one for each event) and just go through the full set of discrete time intervals. So at minute 5 after taking out the trash has been complete, it sets flag "flg_taking_out_the_trash" to 1, which then allows an if statement starting the next task to begin. If it were to check tasks by order of decreasing duration, I believe it would optimize it fairly efficiently, if perhaps not perfectly. Thoughts? Jan 24 '08 #5