A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

New to If statements



 
 
Thread Tools Display Modes
  #1  
Old February 24th, 2010, 05:34 PM posted to microsoft.public.access.queries
swillems
external usenet poster
 
Posts: 1
Default New to If statements

I have a query with service numbers and volumes. What I need is if the
service number = 107, 109, or 105, sum volumes., otherwise show 0.

--
S-
  #2  
Old February 24th, 2010, 06:20 PM posted to microsoft.public.access.queries
Bob Barrows
external usenet poster
 
Posts: 475
Default New to If statements

swillems wrote:
I have a query with service numbers and volumes. What I need is if
the service number = 107, 109, or 105, sum volumes., otherwise show 0.


select ..., sum(iif([service number] in (107,109,105),volumes,0) as
SumOfVolumes ...


--
HTH,
Bob Barrows


  #3  
Old February 24th, 2010, 06:49 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default New to If statements

PERHAPS you want.

SUM(IIF([ServiceNumber] in (105,107,109),[Volume],Null))

Difficult to say without more detail on what you are attempting to do.n

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

swillems wrote:
I have a query with service numbers and volumes. What I need is if the
service number = 107, 109, or 105, sum volumes., otherwise show 0.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:37 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.