473,411 Members | 1,975 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,411 software developers and data experts.

dsum in a query

I would like to calculate a total for all the [hours] field with the same
[ID] in a query.
I don't know how to set the "criteria" for this dsum function, it should be
something like [ID]=[ID] but it doesn't make sense.

The query is something like:

+--[id] --- [client] ---- [personel] ----[hours] --- [What I'd like to
get]---+
+--1-----Alpha-------a1----------------1------------4------------------+
+--1-----Alpha-------a2----------------3------------4------------------+
+--2-----Beta--------b1----------------1------------7------------------+
+--2-----Beta--------b2----------------6------------7------------------+
and so on

TIA
Beppe
Nov 13 '05 #1
3 2935
"beppe005" <be**************@virgilio.it> wrote:
I would like to calculate a total for all the [hours] field with the
same [ID] in a query.
I don't know how to set the "criteria" for this dsum function, it
should be something like [ID]=[ID] but it doesn't make sense.

The query is something like:

+--[id] --- [client] ---- [personel] ----[hours] --- [What I'd like to
get]---+
+--1-----Alpha-------a1----------------1------------4------------------+
+--1-----Alpha-------a2----------------3------------4------------------+
+--2-----Beta--------b1----------------1------------7------------------+
+--2-----Beta--------b2----------------6------------7------------------+
and so on

TIA
Beppe


You don't need DSum.

Include [ID] and [Hours] on a query grid. Click the 'totals' button (like
an upper case 'E') on the toolbar. Under [ID] select 'Group by' from the
drop-down and for [Hours] select 'Sum'.

Regards,
Keith.
www.keithwilby.org.uk
Nov 13 '05 #2
"beppe005" <be**************@virgilio.it> wrote in
news:9u**********************@news3.tin.it:
I would like to calculate a total for all the [hours] field
with the same [ID] in a query.
I don't know how to set the "criteria" for this dsum function,
it should be something like [ID]=[ID] but it doesn't make
sense.

The query is something like:

+--[id] --- [client] ---- [personel] ----[hours] --- [What I'd
like to get]---+
+--1-----Alpha-------a1----------------1------------4----------
--------+
+--1-----Alpha-------a2----------------3------------4----------
--------+
+--2-----Beta--------b1----------------1------------7----------
--------+
+--2-----Beta--------b2----------------6------------7----------
--------+ and so on

TIA
Beppe


A better way to set up something like this is to use a Summation
query joined back to the table in a second query.

If you must use the dsum() you would create a calculated field
containing dsum("hours","tablename"."[tablename].[id] = " & [id])

The veresion if ID is text and not a number is
dsum("hours","tablename"."[tablename].[id] = '" & [id] & "'")
That way, Access knows to sum on the ID field in the table, using
the ID from the query

--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #3
Thanks!

"beppe005" <be**************@virgilio.it> ha scritto nel messaggio
news:9u**********************@news3.tin.it...
I would like to calculate a total for all the [hours] field with the same
[ID] in a query.
I don't know how to set the "criteria" for this dsum function, it should be something like [ID]=[ID] but it doesn't make sense.

The query is something like:

+--[id] --- [client] ---- [personel] ----[hours] --- [What I'd like to
get]---+
+--1-----Alpha-------a1----------------1------------4------------------+
+--1-----Alpha-------a2----------------3------------4------------------+
+--2-----Beta--------b1----------------1------------7------------------+
+--2-----Beta--------b2----------------6------------7------------------+
and so on

TIA
Beppe

Nov 13 '05 #4

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

Similar topics

0
by: Rolan | last post by:
I'm using Access 97 and need some assistance in sorting out a proper DSum expression, or maybe even DCount might be an alternative. I have tried numerous combinations, but with no apparent success....
2
by: Dalan | last post by:
I seemed to be having problems with structuring the use of NZ with a DSum expression. Having tried numerous variations of the expression without success, I'm asking for assistance. First some...
1
by: Alex | last post by:
Acc 97 Hi, I have the following in my query which works well if it is all set to numbers on table design. But what I want to do is where it states MC (short for machine name) use the actual...
3
by: Mark Reed | last post by:
All, I have never used this function before and am not sure it what I need. Just to clarify, I have a report based on a query which has amoungst other field, wk, parea & packs_req. What I am...
4
by: John Baker | last post by:
Hi: At the bottom of a report, I wish to sum all the amounts that appear in a field called Discount$ that appears on the report. I am not doing this summing in the query that supports the report...
2
by: GD | last post by:
tblFoo FooId Name Number 1 One 1 2 Two 2 3 Three 3 The Following query produces the results I want, but it is not updatable. I need at least the...
4
by: stephena | last post by:
Hello all, hope someone can help. I recently built a report showing the distribution of money in and out of the company. Simplified version of which looks like: DECEMBER 2004 TELEPHONE...
7
by: Lewe22 | last post by:
I have a query pulling information from multiple tables, one of which contains a list of students with an auto number their assessment information and how long the assessment took in minutes . ...
3
by: majapa | last post by:
To start, here is my DSum expression: Develop: Nz(DSum(". & "] + . & "]","CSO","='Ability to Develop'")*-1,0) I actually have 4 of these, each one with a different option for . For more context,...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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
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...
0
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...

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.