benallen002
Board Regular
- Joined
- Feb 16, 2005
- Messages
- 65
Hi guys, sorry if this seems like a dumb question, but I am still getting used to Access. I am creating a query that is a totals table based on another query. My SQL statement looks like this:
SELECT Sum(qryLabAsgn.Expr1) AS SumOfExpr1, IIf(Sum(qryLabAsgn.Expr2)=0,"No Total",Sum(qryLabAsgn.Expr2)) AS SumOfExpr2, Sum(qryLabAsgn.Expr3) AS SumOfExpr3
FROM qryLabAsgn;
(I want to apply the IIf statement to all three fields, but am holding off until i can figure this out)
It works fine as long as any of the field in the original query have numbers in them (even a 0), but what happens is that if all the rows in a field are empty, it doesn't display the "No Total" string, it acts as if the IIf statement is false and gives me another empty cell. So I guess my question is, what would be the appropraite IIf statement to check if all the rows in a field contain no values at all?
Thanks in advance for any and all help anyone can be on the matter.
SELECT Sum(qryLabAsgn.Expr1) AS SumOfExpr1, IIf(Sum(qryLabAsgn.Expr2)=0,"No Total",Sum(qryLabAsgn.Expr2)) AS SumOfExpr2, Sum(qryLabAsgn.Expr3) AS SumOfExpr3
FROM qryLabAsgn;
(I want to apply the IIf statement to all three fields, but am holding off until i can figure this out)
It works fine as long as any of the field in the original query have numbers in them (even a 0), but what happens is that if all the rows in a field are empty, it doesn't display the "No Total" string, it acts as if the IIf statement is false and gives me another empty cell. So I guess my question is, what would be the appropraite IIf statement to check if all the rows in a field contain no values at all?
Thanks in advance for any and all help anyone can be on the matter.