S
Steven Phillips via AccessMonster.com
In my query I have Expr1:---,Expr2:---, etc. How can I sum these expression
columns into another column within the same query?
columns into another column within the same query?
MySummedValue: [Expr1] + [Expr2] + [Expr3]
In my query I have Expr1:---,Expr2:---, etc. How can I sum these
expression
columns into another column within the same query?
SumOfExprs:[Expr1] + [Expr2] + [Expr3]
Steven Phillips via AccessMonster.com said:Thanks Ken,
I put this in and it was accepted but rendered no output.
MySummedValue: [Expr1]+[Expr3]+[Expr5]
MySummedValue: [Expr1] + [Expr2] + [Expr3]In my query I have Expr1:---,Expr2:---, etc. How can I sum these
expression
columns into another column within the same query?
Steven Phillips via AccessMonster.com said:Thanks Ken,
I put this in and it was accepted but rendered no output.
MySummedValue: [Expr1]+[Expr3]+[Expr5]
MySummedValue: [Expr1] + [Expr2] + [Expr3]In my query I have Expr1:---,Expr2:---, etc. How can I sum these
expression
columns into another column within the same query?
Steven Phillips via AccessMonster.com said:Thanks again but I'm not getting the right answer. SumOfExprs: yielded an
answer of 121233321, it should have been 675.
In my query I have Expr1:---,Expr2:---, etc. How can I sum these
expression
columns into another column within the same query?
SumOfExprs:[Expr1] + [Expr2] + [Expr3]
Expr1 = Null
Expr2 = 15
Expr3 = 10
Expr1 + Expr2 + Expr3 = Null + 15 + 10 = Null
should be treated as a zero, use this calculated field:Assuming that they might contain Null, and that in those cases the Null
answer of 121233321, it should have been 675.Thanks again but I'm not getting the right answer. SumOfExprs: yielded an
Steven Phillips via AccessMonster.com said:Ken,
I did need the correction you stated for null values. I discovered after
my first response to you that there was a null value in one of the fields
and therefore it resulted as you said. I have updated the query with this
new calculation but my result is incorrect. The response from another
individual (below***) is on target but I don't recognize the function. The
sum I get is as he stated.
Expr1 = Null
Expr2 = 15
Expr3 = 10Expr1 + Expr2 + Expr3 = Null + 15 + 10 = Nullshould be treated as a zero, use this calculated field:Assuming that they might contain Null, and that in those cases the Null
Nz([Expr1],0)+Nz([Expr3],0)+Nz([Expr5],0) AS MySummedValue
answer of 121233321, it should have been 675.Thanks again but I'm not getting the right answer. SumOfExprs: yielded an
***
the answer of 121233321 appears to be the sum of these text fields being
added together: '121' + '233' + '321'. Try Using CInt or the like to make
certain that they are the correct data type.
MySummedValueClng(Nz([Expr1],0))+Clng(Nz([Expr3],0))+Clng(Nz([Expr5],0)) AS
Steven Phillips via AccessMonster.com said:Ken,
That is what it needed, Thanks so much!! Can I possibly ask another
question of you? This query pulls it's data from a table which will
accumulate production data month after month, etc. Two of the expressions
we have been discussing will need to recognize a new month and therefore
not include the prior month in the total. Is it better to do this here, or
when I create the report based on this data.
Expressions 2,4,6 are monthly totals for 3 groups, this calculation will
need to recognize the new month, or the individual expressions
themselves,whichever you suggest.
Expressions 1,3,5 are daily totals and are self maintained with Date()-1
Clng(Nz([Expr2],0))+Clng(Nz([Expr4],0))+Clng(Nz([Expr6],0)) AS
MySummedValue1
MySummedValueClng(Nz([Expr1],0))+Clng(Nz([Expr3],0))+Clng(Nz([Expr5],0)) AS
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.