By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,538 Members | 2,211 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,538 IT Pros & Developers. It's quick & easy.

Dsum Use In Query

P: n/a
GD
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 "Number" field to be updatable.

select Name, Number, (select sum(Number) from tblFoo) as TotalNumber
from tblFoo

So I tried:

select Name, Number, dsum ([Number], "tblFoo") as TotalNumber
from tblFoo

This produces:

Name Number TotalNumber
One 1 3
Two 2 6
Three 3 9

I obviously misunderstand how dsum is supposed to work and I was not
illuminated by the help file.

Any help is appreciated.

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
GD
I did not seem to get any responses to my query below. It seems like a
simple thing (that I unfortunately am not getting), so perhaps I made a
posting etiquette mistake? If someone would tell me what I did wrong I
would certainly appreciate it.

GD wrote:
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 "Number" field to be updatable.

select Name, Number, (select sum(Number) from tblFoo) as TotalNumber
from tblFoo

So I tried:

select Name, Number, dsum ([Number], "tblFoo") as TotalNumber
from tblFoo

This is updatable, but produces:

Name Number TotalNumber
One 1 3
Two 2 6
Three 3 9

I obviously misunderstand how dsum is supposed to work and I was not
illuminated by the help file.

Any help is appreciated.


Nov 13 '05 #2

P: n/a
GD <gy**********@jmjservices.com> wrote in message news:<i1*********************@fe2.columbus.rr.com> ...
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 "Number" field to be updatable.

select Name, Number, (select sum(Number) from tblFoo) as TotalNumber
from tblFoo

So I tried:

select Name, Number, dsum ([Number], "tblFoo") as TotalNumber
from tblFoo

This produces:

Name Number TotalNumber
One 1 3
Two 2 6
Three 3 9

I obviously misunderstand how dsum is supposed to work and I was not
illuminated by the help file.

Any help is appreciated.

In the examples in the help file the name of the field is surrounded
by double quotes. E.g., DSum("[Number]", "tblFoo"). The one you had,
used the value of [Number] in the current record as if it were in
every record. So it resulted in [Number] * RecordCount on that line.

James A. Fortune
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.