473,797 Members | 3,152 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

a kind of Sum Query

Say that we have a table with two fields (Date, Money). Suppose that
date increase sequentally and some "Money" value corresponds to each
date in a row. I need to run a query in which i can a have a column to
provide me Sum_of_Money till each date seperately. Output will be
something as below.

Date Money Sum_of_Total
01-01-2008 100$ 100$
02-01-2008 3$ 103$
03-01-2008 20$ 123$

greatly appreceated for any help!
Mar 24 '08 #1
4 1428
Hi,

mezzanine1974 wrote:
Say that we have a table with two fields (Date, Money). Suppose that
date increase sequentally and some "Money" value corresponds to each
date in a row. I need to run a query in which i can a have a column to
provide me Sum_of_Money till each date seperately. Output will be
something as below.

Date Money Sum_of_Total
01-01-2008 100$ 100$
02-01-2008 3$ 103$
03-01-2008 20$ 123$

greatly appreceated for any help!
OK, let's see what I have...

You could start here:

How to create a running totals query in Microsoft Access
http://support.microsoft.com/kb/290136/EN-US/

and the samples mentioned there, which you can find (
http://support.microsoft.com/kb/207626/EN-US )

Another sample can be found in Rogers Access Library :

RunningSumInQue ry:

http://rogersaccesslibrary.com/downl...SumInQuery.mdb

But maybe this wizard is of interest for you :

Query Add-in for Autonumbers and Running Sums
http://www.fabalou.com/Access/Queries/querycreator.asp

Regards
Jens


Mar 24 '08 #2
Hi Jens,

Thanks for your response.
I tried SQL below. It is not working! Sum_of_Total column produce
empty column. Do you have any idea?
SELECT Table.Date, Table.Money, DSum("Money","T able","[Table]![Date]
<[Date]") AS Sum_of_Total
FROM [Table];
Mar 24 '08 #3
mezzanine1974 <sa************ *@yahoo.comwrot e in
news:271b9b21-c8a7-4f13-93ca-
fd**********@s1 2g2000prg.googl egroups.co
m:
Hi Jens,

Thanks for your response.
I tried SQL below. It is not working! Sum_of_Total column produce
empty column. Do you have any idea?
SELECT Table.Date, Table.Money,
DSum("Money","T able","[Table]![Date] <[Date]") AS Sum_of_Total
FROM [Table];
Your problem comes from using a reserved word as a field name.
Access will interpret [date] as the field.
Date < date will always return false, so you get no money.

Quick fix:
DSum("Money","T able","[Table]![Date] < #" & date() & "#")

Better fix
Change the [date] field name to [MoneyDate]
DSum("Money","T able","[Table]![MoneyDate] < #" & date() & "#")
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Mar 24 '08 #4
Hello Bob,
Thanks for your response.
I gave the example above to simplify my question. The SQL i am using
is quite different. Please see below:

SELECT Qry_Total_forCh art.[Project ID], Qry_Total_forCh art.[PO Date],
DSum("Total","Q ry_Total_forCha rt","[Qry_Total_forCh art]![PO Date]
<=[PO Date]") AS Sum_of_Total
FROM Qry_Total_forCh art;
***
//SQL above yields Empty Sum_of_Total column
***
SELECT Qry_Total_forCh art.[Project ID], Qry_Total_forCh art.[PO Date],
DSum("Total","Q ry_Total_forCha rt","[Qry_Total_forCh art]![PO Date]
<=#"&[PO Date]&"#") AS Sum_of_Total
FROM Qry_Total_forCh art;
***
//SQL above yields Sum_of_Total column but it is not succesfull.
Because some rows repeats the Grand Total which supposed to be get at
the very end row!

SELECT Qry_Total_forCh art.[Project ID], Qry_Total_forCh art.[PO Date],
DSum("Total","Q ry_Total_forCha rt","#"&[Qry_Total_forCh art]![PO
Date]&"# <=#"&[PO Date]&"#") AS Sum_of_Total
FROM Qry_Total_forCh art;
***
//SQL above yields Sum_of_Total column but each row repeats the Grand
Total which supposed to be get at the very end row!

I can not get the correct figure. I really searched groups too much
but i can not fix it.

Thanks for your posting anyway.
Mar 25 '08 #5

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

Similar topics

9
4401
by: LRW | last post by:
I'm not exactly sure how to even ask the question, and I know my terminology is not good as I'm a SQL beginner, but, here goes. I need to find a way to make an if statement within an array...or, the "while" portion of a recordset. The best way I can ask is show what I mean. http://oscarguy.mechphisto.net/awardbrowse.php If you go there and select an award (like Best Picture), leave the year field alone, and select YES and submit,...
2
3435
by: jaysonsch | last post by:
Hello! I am having some problems with a database query that I am trying to do. I am trying to develop a way to search a database for an entry and then edit the existing values. Upon submit, the new values are updated in all corresponding tables (the function of the pages in question). However, on the page that does the DB update, I also want to do some checks on the data before performing the update. Now, the problem that I am...
2
2329
by: Joh | last post by:
Hello, (sorry long) i think i have missed something in the code below, i would like to design some kind of detector with python, but i feel totally in a no way now and need some advices to advance :( data = "it is an <atag> example of the kind of </atag> data it must handle and another kind of data".split(" ")
29
2477
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules" for when and how to use single quotes and double quotes in ASP? thanks! ---------------------- SQL = SQL & "WHERE '" & REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE("GenKTitles.
3
5395
by: Harvey | last post by:
Hi, I try to write an asp query form that lets client search any text-string and display all pages in my web server that contain the text. I have IIS 6.0 on a server 2003. The MSDN site says there is a sample file called Ixtrasp.asp, but I could not find it in my system although I installed indexing service. I followed the steps in MSDN site to create a basic .asp query form (too long to post it here), but it always displays: No...
1
2713
by: Henro V | last post by:
I am byuilding this database which (among others things) will have to produce a kind of calendar. Users give in the appointments they have and how long they take. F.e: John Doe is attending a conference which will take three days. This conference starts on 12-07-2004 So the user would give in a) Name John Doe (selectable from a list,
10
1600
by: frizzle | last post by:
Hi Group, I'm builiding a sort of a news-site, with a mySQL backend. Nowadays, i come across a lot of news-pages with the title of the article in the URL. For example this one: http://www.nieuwnieuws.nl/ (dutch in this case) Anyway, every article seems to have it's own html-page. I know that the page in my example actually has php-pages and a mysql-db.
2
1078
dlite922
by: dlite922 | last post by:
I have two tables, i do a simple join on it (the only one i know how) but i want the results to show even though the join a.... ahh... here i can show you faster than i can tell you.... Case table. id, caseNumber Trial table
4
1723
by: CoreyReynolds | last post by:
Hey all, This may be the dumbest thing I've ever seen. I'm creating a queryDef in VBA for access. Here's a sample of the query it creates: SELECT tblEquipment.equipmentID, tblSample.sampleDate, tblSampleResults.Chromium, IIf(=True,'X',(IIf(=True,'U',' '))) AS Critical FROM (((tblEquipment INNER JOIN tblCompartment ON tblEquipment. = tblCompartment.) INNER JOIN tblSample ON tblCompartment. = tblSample.) INNER JOIN...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9537
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10469
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
10246
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...
0
9066
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...
1
7560
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5459
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...
2
3750
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2934
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.