It will go to first record and as per the example if
it reads 50 which is less than 200 asked by user it
moves on next record adds previous 50+new record 100
which makes it 150 (stores it in a variable).
*******every time it stores add value in variable
before moving on next record
It again checks the condition (with stored variable)
which is still < 200.
moves to next records add 100+150 (variable stored)
which makes 250 which is > 200 .
Now it search for 200 in reverse direction(ie. from
last to first record). As soon as it founds the right
combination it will show those records and leaves 50
out.
I know it is bit cumbersome but I am quite sure it is
workable .
I am clear about the logic but needs from scratch the
coding and I am sure I can get it from you.