Not sure how easy it is to do it in VB, but before I try it in the SQL I thought I'd see if there's an easy way to sum a quantity for a date range. The data is layed out like this:

Date Quantity
4/1/2006 1
4/1/2006 5
4/2/2006 3
4/4/2006 8
4/4/2006 5
4/10/2006 15

So for example, on the above data I would want to make sure that from 4/1/2006 through 4/4/2006 are summed up, but 4/10 is excluded. I wrote what I think should keep the 4/10 date out as follows:
******
numbervar DaysToEnd;
datevar FirstDay; //this is a date which is already set manually
datevar ToDate; //Used to sum from 'FirstDay' through 'ToDate'

DaysToEnd := 7 - dayofweek(firstday);
ToDate := firstday + DaysToEnd;
******

Now I don't know if I do a 'whileprintingrecords' or what. I need it to go through every record and sum up 'Quantity' starting with FirstDay, then check all of the FirstDay + 1, etc...until it reaches ToDate. Using the above sample data the sum should come out to 22.

Hope that's somewhat clear for anyone that can help?