473,396 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1407
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 :

RunningSumInQuery:

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","Table","[Table]![Date]
<[Date]") AS Sum_of_Total
FROM [Table];
Mar 24 '08 #3
mezzanine1974 <sa*************@yahoo.comwrote in
news:271b9b21-c8a7-4f13-93ca-
fd**********@s12g2000prg.googlegroups.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","Table","[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","Table","[Table]![Date] < #" & date() & "#")

Better fix
Change the [date] field name to [MoneyDate]
DSum("Money","Table","[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_forChart.[Project ID], Qry_Total_forChart.[PO Date],
DSum("Total","Qry_Total_forChart","[Qry_Total_forChart]![PO Date]
<=[PO Date]") AS Sum_of_Total
FROM Qry_Total_forChart;
***
//SQL above yields Empty Sum_of_Total column
***
SELECT Qry_Total_forChart.[Project ID], Qry_Total_forChart.[PO Date],
DSum("Total","Qry_Total_forChart","[Qry_Total_forChart]![PO Date]
<=#"&[PO Date]&"#") AS Sum_of_Total
FROM Qry_Total_forChart;
***
//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_forChart.[Project ID], Qry_Total_forChart.[PO Date],
DSum("Total","Qry_Total_forChart","#"&[Qry_Total_forChart]![PO
Date]&"# <=#"&[PO Date]&"#") AS Sum_of_Total
FROM Qry_Total_forChart;
***
//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
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,...
2
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...
2
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...
29
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"...
3
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...
1
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...
10
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:...
2
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.... ...
4
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,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.