One of the solution for similar problem I know was posted by Rustam Mukumov on the Visial FoxPro Clubs(Russian), Special problems Area:
http://nsvisual.com/fox2/netr/netr.php3?file=task04.htm You need to modify it slightly to meet your goal. Let me know if you need my assistance.
>Yes, that's it. But the final order of the elements does not have importance. I mean: 123 it's the same that 213 ou 321. I need to use that because I have a program that has a .dbf on wich I record every pay-check received, with your respective value and deposit date. My client suggest to me the following idea: given a value and two dates, the software will locate all the pay-checks or any combination of the recorded pay-checks that will give in the sum a value that must not be higher that the given value. Like I have sayed, hard to do. Thanks again.