Question : Create a running total in a query

I have a TableA with the field Total.  TableA only has one entry under Total.   I also TableB with the field actual. Table B has numerous entries under the field actual.

I want to create a query that will list each entry in Table B in one column and in the second column a decreasing total  (Total from TableA - Entry in TableB).

Answer : Create a running total in a query

Hi lashler2,

If I have understood your post correctly I am not sure if this can be done in a query.  If I am right you have the following:

Table A = 1 row of data with a value in the total field (1000 for example)

Table B = multiple rows with smaller values in the Actual filed

In your output you want to see a remaining value from the Total based on the cumulative values in the Actual Fileds

i.e.

 Total    Actual    Remaining
1000     10           990
1000      100         890
1000     50            840
etc...

(Sorry if the layout is poor!)

If this is the case then I do not know of a way to accomplish this in a query.

You could try to cheat using a report if that might suffice.

In a report you could display the Total value in one field and the Actual value in another.  You can then set the properties of the Actual value to be a "Running Sum" which should display the running total of the actual values.  Then add another text box and set the control for this to be [Total]-[Running Sum Of Actual]

This might then display the information you are after.

Please note, there is probably a much better way to do this so just hang in there for a while to see if any of the experts can come up with something for you.

Hope this helps,

Mark.
Random Solutions  
 
programming4us programming4us