?
Solved

Another expression in a query

Posted on 2014-01-22
1
Medium Priority
?
118 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 25

Accepted Solution

by:
chaau earned 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
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 …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

850 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