Dsum bigger or smaller than 0

DaRTHY

Registered User.
Local time
Today, 13:42
Joined
Mar 6, 2015
Messages
90
Hello friends

i have a simple question i could not find any solution:(

this is my code : (im using 2007-2010 and its working like that)

Code:
=Dsum("*";"Table Name";"[Field Name] < 0")

i need to calculate only bigger than 0 or smaller than 0 doesnt matter..

i checked from Forum etc. there is only between 2 dates options.

Ty for your helps.
 
Huh?

1. You need to supply a field to sum, you can't sum on *.

2. Bigger than or smaller than 0, means you want to exclude 0, so you use this in your criteria argument:

[Field Name]<>0
 
It is not clear from your description what you want. Show an example consisting of some records and then the desired result.
 
okey. im sending a picture now. in my field - and + values. I need to calculate them. For example :

-152400 + (-70)= -152470 these values smaller than 0
and same thing for + values too.
 

Attachments

  • 2.JPG
    2.JPG
    18.2 KB · Views: 123
How about doing 2 dsums?

=Dsum("*";"Table Name";"[Field Name] < 0")
=Dsum("*";"Table Name";"[Field Name] > 0")

Or more efficent it would be to do a single query
Code:
Select 
sum(iif(yourfield>0,yourfield,0)),
sum(iif(yourfield<0,yourfield,0))
from YourTable
 
i have already written this
=Dsum("*";"Table Name";"[Field Name] < 0")
to my text box but not working. And i really dont know how shall i write to text box sql. Is that again in Control source ?
 
okey i guess i found how can i do that.
i created 1 more field for - values and + values too (i was thinking i can do them in same field but this is more fast and easy)
now i can sum them ;)
Ty Namlian :)
 
If you want to sum them all I dont see the point

-10+5-9+4-8 = -27 + 9 = -18

-10+0+5-9+0+4-8+0 will still = -18??
 
for my report i need to sum them as 3 different parts. firstly - then + and total. they want to see all values.
 
Code:
=Dsum("*";"Table Name";"[Field Name] < 0")

Again, you need to tell DSum what field to sum. You can't use * in DSum.
 
I don't know if you can do this directly: you need something like

dsum("fieldname","select * from tablename where fieldname < 0")

not sure offhand if you can use a sql string directly in this expression.

---
you could easily just save the sql string as a query though, and then
dsum("fieldname","queryname")
 

Users who are viewing this thread

Back
Top Bottom