Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

# Sum in a query

Posted on 2014-01-27
Medium Priority
337 Views
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
Question by:cansevin
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 143

Expert Comment

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.

0

LVL 75

Accepted Solution

DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 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

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 31

Expert Comment

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

Question has a verified solution.

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

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…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
###### Suggested Courses
Course of the Month10 days, 22 hours left to enroll