Solved

Another expression in a query

Posted on 2014-01-22
1
108 Views
Last Modified: 2014-01-29
Using query designer I need code to:

Sum the totals of [NumberOfHours] where PublicActivityCode] = "GT" or "ST".

It needs to be an expression because I have more of these types of fields to add.


An expert already helped me wit another code which worked for that one.  It was:

TouringCount: Sum(Abs([PublicActivityCode]="GT" Or [PublicActivityCode]="ST"))

So it has to be something like: (but the syntax is wrong)

TotalHours: Sum(Abs(NumberOfHours] WHERE ([PublicActivityCode]="GT" Or [PublicActivityCode]="ST"))

--Steve
0
Comment
Question by:SteveL13
1 Comment
 
LVL 24

Accepted Solution

by:
chaau earned 500 total points
ID: 39801442
I think, something like this will work:
TotalHours: Sum(iif([PublicActivityCode]="GT" Or [PublicActivityCode]="ST", [NumberOfHours], 0))

Open in new window

0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access 2016 7 33
SQL - Cumulating field values to one field 5 19
Macro to import XML in Access 2013 2 34
Why can't I get rid of record selectors on my form? 9 28
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

786 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