Re: Conditional Running Sum
- From: Arch <send.no@xxxxxxxx>
- Date: Mon, 31 Mar 2008 12:17:30 -0400
On Sun, 30 Mar 2008 22:55:30 -0700 (PDT), mezzanine1974
<savas_karaduman@xxxxxxxxx> wrote:
Hello Arch,
You are right that i did a mistake in the first line.
your statement CORRECT! <By "between" do you mean inclusive of the
Start date but not the
Finish date?>
It probably can be done in SQL, but I'm not good enough in SQL to do
it. This function works as you requested, however:
Public Function CalcSum(Tdate As Date)
Dim SQL As String
Const StartDate As String = "Sdate"
Const FinishDate As String = "Fdate"
SQL = "Select sum(money) from q1 " & _
"where #" & Tdate & "# >= " & StartDate & _
" AND #" & Tdate & "# < " & FinishDate
CalcSum = CurrentProject.Connection.Execute(SQL).GetString
CalcSum = Left(CalcSum, Len(CalcSum) - 1)
End Function
SELECT SortedDate,
CalcSum(SortedDate) as RunSum
FROM Query1 ;
SortedDate RunSum
1/1/2008 1
2/1/2008 1
3/1/2008 10
4/1/2008 12
5/1/2008
-Arch
.
- Follow-Ups:
- Re: Conditional Running Sum
- From: mezzanine1974
- Re: Conditional Running Sum
- References:
- Conditional Running Sum
- From: mezzanine1974
- Re: Conditional Running Sum
- From: Arch
- Re: Conditional Running Sum
- From: mezzanine1974
- Conditional Running Sum
- Prev by Date: dbhiddenobject doesnt work
- Next by Date: Re: dbhiddenobject doesnt work
- Previous by thread: Re: Conditional Running Sum
- Next by thread: Re: Conditional Running Sum
- Index(es):
Relevant Pages
|