473,568 Members | 2,923 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IIF Statement In Query

32 New Member
Hello Every One,

I am having a problem with an IIF statement in a query I have going. Before I start I would like to say I have had some problems in the past with supplying enough information, if you need more information just ask and I'll try my best to give it.

What i have is a query that is beeing used for a weekly report, this weekly report is broken down in weeks, using the following code "
Expand|Select|Wrap|Line Numbers
  1.  CStr([Date Of Arrival]-Weekday([Date Of Arrival],6)+1) & " - " & CStr([Date Of Arrival]-Weekday([Date Of Arrival],6)+7) AS WeekPeriod
"

The next part counts the number of arrivals that week period and then counts the number of individuals that get Permanent IDs(PermID)(Che ck Box) as the days go on.

What I need the IIF statement to do is count the individuals that do not have a Permanent ID that are on vacation(Vacati on), this way we can see why every one has not gotten a Permanent ID.
Example:
If John Doe, arrived on march 31st, went on vacation, and never picked up his permenant ID then in that field it would count 1
I tried the following
Expand|Select|Wrap|Line Numbers
  1. IIF([PermID]) = 0, Sum(Vacation)*-1, 0)
But I keep getting an error.

I relize that this question is fairly simple and for some reason it is just not working so I figured get a cupple people to look at it and put in there 2 cents.

Table Structior:
tblAll:
EmployeeID - PK - Auto Number
Name
PermID - Check Box
Vacation - Check Box

If there is any other information that is needed then please just ask I am sorry if i have left out anything importent, but as far as I know for the question that I have stated that is more then enough info.

P.S. This is going to prob. be my last question, since I will be handing this Database over to some one else, I just wanted to take this chance to thank every one that has helped me on these Odd and frustrating questions that I have asked, It has been a great help.
Thank You Again
Aug 20 '07 #1
1 1494
Stwange
126 Recognized Expert New Member
Instead of:
IIF([PermID]) = 0, Sum(Vacation)*-1, 0)

Try:
Sum(IIf([PermID] = 0, Vacation * -1, 0)

Unless I am misunderstandin g you.

Also, note that you have closed the bracket too early on your example, it should read IIF([PermID] = 0, Sum(Vacation)*-1, 0)

Good Luck.
Aug 20 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
35666
by: Bob | last post by:
Currently I am using this statement to translate 3 fields in my db thru Visual Basic. I import the data from one table to another then call the IFF statements and the NewDate to translate the fields. Can this be done in an Access db? I am trying to learn how to do these things in Access vs Visual Dim strIIF As String Dim sstrIIF As String...
7
11424
by: mark | last post by:
Access 2000: I creating a report that has a record source built by the user who selects the WHERE values. An example is: SELECT * FROM CHARGELOG WHERE STDATE Between #10/27/2003# And #11/2/2003# And VehicleID='00000000' And BattID='LKO500HF'. I need to use the records returned to populate text boxes, but the data requires further...
4
5114
by: Polly | last post by:
I had a macro that ran a parameter query and created and opened an Excel file with the system date as part of the file name, but I had to change the file name by hand. So I converted the macro to code using tools-->references. The converted macro included the following statement: DoCmd.OutputTo acQuery, "qselLabelsBloodLog_output",...
3
4605
by: Andy_Khosravi | last post by:
I have been trying to build a user friendly search engine for a small database I have created. I'm having some particular problems with one of my date fields. Here's the setup: I'm using Access 97 (I know it's old. But, it's the tool they give me to work with) My working knowledge of SQL is on the low side. My working knowledge of VBA...
14
5662
by: Siv | last post by:
Hi, I just discovered that if in an ADO.NET query I use: "Select * from Invoices Where InvoiceDate BETWEEN StartDate AND EndDate;" In this case StartDate would be 1st of month and EndDate would be the last day of the month, e.g. 31/08/2005 (UK DD/MM/YYYY format) I find that the query is missing off any invoices that were done on the 31st...
2
3179
by: Geoffrey KRETZ | last post by:
Hello, I'm wondering if the following behaviour is the correct one for PostGreSQL (7.4 on UNIX). I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching the following request : INSERT INTO temp_tab VALUES (1,2,3)
1
3619
by: Matt | last post by:
I am writing a DELETE statement and I want to filter the records using another SELECT statement. My SELECT statement is a GROUP BY query that grabs all social security numbers from the "Data With Import Date Current" table on a given day where there was only one transaction (count of SSN = 1). I want to delete these records from the "Data...
0
9957
ADezii
by: ADezii | last post by:
One frequently asked question at TheScripts is "Should I use a Stored Query or an SQL Statement in those situations that require a Query (RecordSets, RecordSources, Append, Delete, Update Operations, etc.)?" The response, in virtually all but a few circumstances, is that you should use a Stored Query in place of the parallel SQL Statement. The...
3
7692
by: Joshepmichel | last post by:
Please to help me to following problem I want to do this 1. create Table Name MEMBER on the Database Name "mytestdb", 2. Add the Values to the Table through the Key board Inputs during running the My Java Application.; Therefore I used this following codes, It Consists the seperate parts for the Raede and Member Class for the purposely I...
3
15874
by: Eric Davidson | last post by:
DB2 9.5 I keep geting the message. SQL0101N The statement is too long or too complex. SQLSTATE=54001 When one of my sql statements takes over 60 seconds to compile the sql statement. Is there any parameter that controls how long DB2 allows a statement to compile for.
0
7605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7917
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6277
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5501
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.