Solved

Another expression in a query

Posted on 2014-01-22
1
105 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
Comment Utility
I think, something like this will work:
TotalHours: Sum(iif([PublicActivityCode]="GT" Or [PublicActivityCode]="ST", [NumberOfHours], 0))

Open in new window

0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now