Solved

Sum in a query

Posted on 2014-01-27
4
322 Views
Last Modified: 2014-01-28
I am having trouble running a sum in a query for one particular column. The "count" works fine, it just won't sum. I'm guessing it isn't reading it as a number properly, correct?

How can I fix the problem? It comes from a query that runs an expression that is:

BookedTrue: Abs(Sum([Booked]=True And [RecordedMessage]=[qryWhosComputer]![Last]))

It is that value that isn't properly allowing me to sum. Thanks!
0
Comment
Question by:cansevin
4 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39813167
can you please explain what you want to "sum" ?

SUM( <expression> ) is only for the expression returning numbers.
your expression is a boolean expression which will return only true or false.

please clarify
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 500 total points
ID: 39813211
Seems you would want:


BookedTrue: Abs(Sum([Booked))

and a WHERE clause of

WHERE  [RecordedMessage]=[qryWhosComputer]![Last]

mx
0
 
LVL 31

Expert Comment

by:Helen_Feddema
ID: 39813215
Generally speaking, with Boolean fields, what you need is a count of the True values (or maybe of the False values, depending on your needs).
0
 
LVL 30

Expert Comment

by:hnasr
ID: 39813842
In this case sum works as count, because it sums abs(-1)s or 0s.
The expression returns a Boolean value, -1 or 0.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question