I'm still trying to solve my problem with getting a previous total/balance/inventory into a table so I can use it in a report. I have a table tblActivity
tblActivity
ActivityID
StartDate - format General Date
WeightometerUnit1- number
WeightometerUnit2- number
Typical Data
1 11/21/07 200 400
2 11/22/07 300 200
3 11/22/07 500 300
4 11/23/07 800 200
5 11/25/07 600 500
I would like to be able to run a report for say 11/23-11/25 that would show the following:
Usage Previous Current
Date Total Unit1 Unit2 Total
11/23/07 1900 800 200 2900
11/24/07 2900 0 0 2900
11/225/07 2900 600 500 4000
I have query qryDailyUnitTotals
If I select 11/23/07 - 11/25/07, the query gives me
UsageDate Unit1 Unit2 Total
11/23/07 800 200 1000
If I select 11/2/07 - 11/26/07, the query gives me
UsageDate Unit1 Unit2 Total
11/23/07 800 200 1000
11/25/07 600 500 1100
I have query qryPreviousTotal
It will return one total amount for all the days prior to the selected start date.
So if I select 11/23/07, it returns "1900", which is what I want as my "Previous Total" for 11/23/07 in my report.
What I can't do is use that "Previous Total" in my report for the "Previous Total" so I can then add the daily amounts to it to get the "Current Total".
If I put a Running Sum for the Total in the report, it only sums the values for the selected dates.
Any suggestions?
Thanks,
Brian
tblActivity
ActivityID
StartDate - format General Date
WeightometerUnit1- number
WeightometerUnit2- number
Typical Data
1 11/21/07 200 400
2 11/22/07 300 200
3 11/22/07 500 300
4 11/23/07 800 200
5 11/25/07 600 500
I would like to be able to run a report for say 11/23-11/25 that would show the following:
Usage Previous Current
Date Total Unit1 Unit2 Total
11/23/07 1900 800 200 2900
11/24/07 2900 0 0 2900
11/225/07 2900 600 500 4000
I have query qryDailyUnitTotals
Code:
SELECT DateValue(tblActivity.StartDate) AS UsageDate, Sum(nz(tblActivity.WeightometerUnit1,0)) AS Unit1, Sum(nz(tblActivity.WeightometerUnit2,0)) AS Unit2, Sum(nz(WeightometerUnit1,0)+nz(WeightometerUnit2,0)) AS Total
FROM tblActivity
WHERE (((DateValue(tblActivity.StartDate)) Between Forms!frmWeightometerReport!tbxStartDate And (Forms!frmWeightometerReport!tbxEndDate)))
GROUP BY DateValue(tblActivity.StartDate);
If I select 11/23/07 - 11/25/07, the query gives me
UsageDate Unit1 Unit2 Total
11/23/07 800 200 1000
If I select 11/2/07 - 11/26/07, the query gives me
UsageDate Unit1 Unit2 Total
11/23/07 800 200 1000
11/25/07 600 500 1100
I have query qryPreviousTotal
Code:
SELECT Sum(nz(WeightometerUnit1,0)+nz(WeightometerUnit2,0)) AS PreviousTotal
FROM tblActivity
WHERE (((DateValue(tblActivity.StartDate))<Forms!frmWeightometerReport!tbxStartDate));
It will return one total amount for all the days prior to the selected start date.
So if I select 11/23/07, it returns "1900", which is what I want as my "Previous Total" for 11/23/07 in my report.
What I can't do is use that "Previous Total" in my report for the "Previous Total" so I can then add the daily amounts to it to get the "Current Total".
If I put a Running Sum for the Total in the report, it only sums the values for the selected dates.
Any suggestions?
Thanks,
Brian