473,666 Members | 2,386 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Running Totals by date misbehaving ?

Running Totals by date misbehaving

I applied to the letter the sample code given
on http://support.microsoft.com/?kbid=290136

but it seems the running total breaks when the day number
is less than the previous date

Example using one Table (Access 2000):

ES QAC
6/ 8/2005 100
6/10/2005 50
6/10/2005 200
6/15/2005 400
7/ 2/2005 20
7/14/2005 60
7/14/2005 600
8/ 3/2005 500
8/20/2005 10

Expected result :

ES QAC
6/ 8/2005 100
6/10/2005 350
6/15/2005 750
7/ 2/2005 770
7/14/2005 830
8/ 3/2005 1130
8/20/2005 1140

The Query :

First Column :
Field : AMonth : DatePart("m",[ES])
Total : Group by
Sort : Ascending
Show : Yes

Second Column :
Field : ADay : DatePart("d",[ES])
Total : Group by
Sort : Ascending
Show : Yes

Third Column :
Field : RunTot: DSum("QAC","Tes t","DatePart('d ', _
[ES])<=" & [ADay] & " And DatePart('m', _
[ES])<=" & [AMonth] & "")
Total : Expression
Show : Yes
Obtained result from the above Query :
ES QAC
6/ 8/2005 100
6/10/2005 350
6/15/2005 750
7/ 2/2005 20 <--- ???
7/14/2005 1030
8/ 3/2005 520 <--- ???
8/20/2005 1940

Can somebody tell me where I went wrong ?
Thank you for your help.

J.P.

Nov 13 '05 #1
1 2154
u473 wrote:
Running Totals by date misbehaving

I applied to the letter the sample code given
on http://support.microsoft.com/?kbid=290136

but it seems the running total breaks when the day number
is less than the previous date

Example using one Table (Access 2000):

ES QAC
6/ 8/2005 100
6/10/2005 50
6/10/2005 200
6/15/2005 400
7/ 2/2005 20
7/14/2005 60
7/14/2005 600
8/ 3/2005 500
8/20/2005 10

Expected result :

ES QAC
6/ 8/2005 100
6/10/2005 350
6/15/2005 750
7/ 2/2005 770
7/14/2005 830
8/ 3/2005 1130
8/20/2005 1140

The Query :

First Column :
Field : AMonth : DatePart("m",[ES])
Total : Group by
Sort : Ascending
Show : Yes

Second Column :
Field : ADay : DatePart("d",[ES])
Total : Group by
Sort : Ascending
Show : Yes

Third Column :
Field : RunTot: DSum("QAC","Tes t","DatePart('d ', _
[ES])<=" & [ADay] & " And DatePart('m', _
[ES])<=" & [AMonth] & "")
Total : Expression
Show : Yes
Obtained result from the above Query :
ES QAC
6/ 8/2005 100
6/10/2005 350
6/15/2005 750
7/ 2/2005 20 <--- ???
Well...2 is less than 8, 10, and 15. Makes sense to me.
7/14/2005 1030
8/ 3/2005 520 <--- ???
8/20/2005 1940

Can somebody tell me where I went wrong ?
Thank you for your help.

J.P.

Why dont you do something like
Field : RunTot: DSum("QAC","Tes t","ES <= " & [Test]![ES])
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
5686
by: fwells11 | last post by:
Hi there. As you will see from my questions, I am an SQL newb. I dabble but never get to spend enough time to get proficient so base any feeedback on that basis please. This is all theoretical information at this point so I am also going to post this in a MySQL related group. I will create some designs and post back to the group if I get any feedback I can use. Problem: I would like to be able to keep a running percentage total in...
8
4111
by: Tony Williams | last post by:
I have a database that hold s figures for each quarter. I want to create a query whereby the user can ask for the running total of the data upto the quarter they enter into a prompt. The database stores the quarter name in txtmonthlabel (a date field) and the quarters totals in txtdomic (a number field) EG If the user enters March 2004 they get figures upto March 2004, if they enter June 2004 they get total upto June 2004, in other words...
0
1302
by: ddecoste | last post by:
I have done a bunch of looking but I am confused as to the correct way I should proceed with this problem. I have query that returns: It is sorted by ordnum then, linenum, then date and it creates a table called Temptable. ordnum linenum qtyord Date qtyship 1234 1 500 2/1/05 150 1234 1 500 2/2/05 200 1234 2 300 2/5/05 130
6
2935
by: KashMarsh | last post by:
Trying to show running totals on a report, except it needs to show one total amount and values being subtracted from it. For example, the report shows a Total Inventory amount (TotInvAmt). And then amounts for each month for the orders like JanAmt, FebAmt, etc. I want to show under each month column the following: (TotInvAmt)-(JanAmt)=B ----result shows under the Jan column B-(FebAmt)=C ---------result shows under the Feb column...
0
1364
by: Beacher | last post by:
Hi all, I'm having troubles with a report I've created. You make some selections on a form which then sets a reports filter property and opens the report, this works fine. One bigger problem I've had is that any of my running totals are still showing totals as if there was no filter. I filter on 2 things one being a customer, two being a date. If I select a specific customer the totals will properly show total spent
3
4135
by: mochatrpl | last post by:
I am looking for a way to make a query / report display the running average for total dollars. I have already set up a query to provide totals dollars per day from which a report graphly shows the dollars per week. How do I then take the dollars and get a running average for the year? - Randy
9
4016
by: JJM0926 | last post by:
I'm trying to create a running totals query in access 97. I have followed the directions on how to do it from Microsofts website article id 138911. I took their code they had and replaced it with my fields. When I try to run it I get #errors in my RunTot column. I'm kinda new to this. Not sure if maybe I mistyped something wrong or is there a better way to do this? I have pasted the code. Any help would be greatly appreciated....
6
4879
by: Stuart Shay | last post by:
Hello All: I have a array which contains the totals for each month and from this array I want to get a running total for each month decimal month = new decimal; month = 254; (Jan) month = 78; (Feb) month = 34; (Mar) ect ...
5
2326
by: colin spalding | last post by:
How do I design a totals query that instead of the following result YearOfAcc PremiumGBP 2004 9,142,306.95 2004 1,481,153.21 2005 11,981,987.85 2006 20,653,195.20 2006 -521,140.08 2006 -455,788.20 2006 -212,507.35
0
8866
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7381
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4365
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2769
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2006
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.