dbTalk Databases Forums  

Dsum Use in Query

comp.database.ms-access comp.database.ms-access


Discuss Dsum Use in Query in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
GD
 
Posts: n/a

Default Dsum Use in Query - 07-13-2004 , 11:59 AM






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.


Reply With Quote
  #2  
Old   
Rob Parker
 
Posts: n/a

Default Re: Dsum Use in Query - 07-21-2004 , 07:15 PM






GD <gypsydweller (AT) jmjservices (DOT) com> wrote

Quote:
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.
select Name, Number, dsum ("Number", "tblFoo") as TotalNumber from
tblFoo

gives what you want, and the "Number" field is updatable (but the
TotalNumber field does not change until you re-run the query).

Rob


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.