?
Solved

Sum in a query

Posted on 2014-01-27
4
Medium Priority
?
334 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
[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
  • Learn & ask questions
4 Comments
 
LVL 143

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 - 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

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
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

764 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