473,804 Members | 2,277 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Iif Statement - Operand Error

10 New Member
I have attempted to use the following IIF statement in a query, with no success.

Iif([Branch]="580" OR "585", Iif(Month([Estimate_Comple ted])=Month(Now()), [Charge]=[Charge]+40), Iif(Month([Estimate_Comple ted])=Month(Now()), [Charge]=[Charge]+100) Iif(Month([Layout_Complete d])=Month(Now()),[Charge]=[Charge]+100))

I tried to include a field in my query name Charge using the,

Charge:Iif(...c ode above...)

Method, but I get the following error;

You have entered an operator, such as the + operator, in an expression without a corresponding operand.

What the hell does this mean? Help?
Aug 29 '07 #1
6 1888
missinglinq
3,532 Recognized Expert Specialist
Trying to follow your code has given me a worse headache than if I had drunk an entire bottle of Catain Morgan, but the first (and maybe only) mistake is:

[Branch]="580" OR "585"


This needs to be

[Branch]="580" OR [Branch] ="585"

Linq ;0)>
Aug 29 '07 #2
JKing
1,206 Recognized Expert Top Contributor
You need to set something = "585" in your OR clause...

Try this

Expand|Select|Wrap|Line Numbers
  1. Iif([Branch]="580" OR [Branch] = "585", Iif(Month([Estimate_Completed])=Month(Now()), [Charge]=[Charge]+40), Iif(Month([Estimate_Completed])=Month(Now()), [Charge]=[Charge]+100) Iif(Month([Layout_Completed])=Month(Now()),[Charge]=[Charge]+100))
  2.  
On a side note there maybe a missing comma or bracket in there but lets try one thing at a time.
Aug 29 '07 #3
mlcampeau
296 Recognized Expert Contributor
I have attempted to use the following IIF statement in a query, with no success.

Iif([Branch]="580" OR "585", Iif(Month([Estimate_Comple ted])=Month(Now()), [Charge]=[Charge]+40), Iif(Month([Estimate_Comple ted])=Month(Now()), [Charge]=[Charge]+100) Iif(Month([Layout_Complete d])=Month(Now()),[Charge]=[Charge]+100))

I tried to include a field in my query name Charge using the,

Charge:Iif(...c ode above...)

Method, but I get the following error;

You have entered an operator, such as the + operator, in an expression without a corresponding operand.

What the hell does this mean? Help?
I've never seen anyone close the IIF bracket before starting the next iif, so that could be causing the error. I fixed the brackets and added commas, and added the "" for if the statement is false. Try this:

Expand|Select|Wrap|Line Numbers
  1. Iif([Branch]="580" OR [Branch] = "585", Iif(Month([Estimate_Completed])=Month(Now()), [Charge]=([Charge]+40), Iif(Month([Estimate_Completed])=Month(Now()), [Charge]=([Charge]+100), Iif(Month([Layout_Completed])=Month(Now()),[Charge]=[Charge]+100, ""))))
  2.  
Aug 29 '07 #4
JKing
1,206 Recognized Expert Top Contributor
Trying to follow your code has given me a worse headache than if I had drunk an entire bottle of Catain Morgan, but the first (and maybe only) mistake is:

[Branch]="580" OR "585"


This needs to be

[Branch]="580" OR [Branch] ="585"

Linq ;0)>
Must have been responding at the same time there Linq didn't mean to step on your toes though it seems we both came to the same conclusion.
Aug 30 '07 #5
missinglinq
3,532 Recognized Expert Specialist
Ouch! LOL! I try to check before posting, but the way this forum is set up makes it a real pain! If you get distracted at all in mid-reply, to check before posting you've got to copy your response, back out and reload the page, and if no one else has replied, click on "Post a reply" and paste your response in and post it! Life's way too short!

Linq ;0)>

The guys that really frost me, and we don't see much of it here, knock wood, are the ones who come along hours later and post a solution/answer that's already been posted!
Aug 30 '07 #6
mlcampeau
296 Recognized Expert Contributor
The guys that really frost me, and we don't see much of it here, knock wood, are the ones who come along hours later and post a solution/answer that's already been posted!
sorry, i was just fixing the brackets and commas that no one addressed
Aug 30 '07 #7

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

Similar topics

17
5694
by: shank | last post by:
I'm coming from the ASP worl and have no clue to javascript. In the following code, I'm trying to set the value for variable strPage, then use that in the redirect statement. The page does nothing. No redirect at all. What should the synatx be? thanks! <SCRIPT LANGUAGE="JavaScript"> if Session("SoftHard") = "Hard" { strPage = "hardpage.asp?OrderNo=" & Session("OrderNo");
35
8364
by: Thomas Matthews | last post by:
Hi, My son is writing a program to move a character. He is using the numbers on the keypad to indicate the direction of movement: 7 8 9 4 5 6 1 2 3 Each number has a direction except for '5'. So in his switch statement, he omits a case for '5':
3
1564
by: tconkling | last post by:
I have an if statement that looks like this: if(foo(&x) && x > y) ... where the value of x is modified by foo, and the comparison between x and y only makes sense after x has been modified by foo (and, of course, if foo returns true). Am I guaranteed (assuming my compiler generates correct code) that x > y is evaluated after foo(&x) returns?
15
2814
by: Nerox | last post by:
Hi, If i write: #include <stdio.h> int foo(int); int main(void){ int a = 3; foo(a); }
6
13588
by: BlueTrin | last post by:
Hello I was adapting a C version of SolvOpt in C++ to use it within a virtual class. However I am stuck with the overriding of evaluation and gradiant functions. cStepCurveEvaluator.cpp cStepCurveEvaluator.cpp(14) : error C2296: '.*' : illegal, left operand
7
5055
by: nkumarin001 | last post by:
Hi, Can anyone please help me to rectify the problem. Hi i wrote the following code regarding CASE statement:- declare num number :=45; begin case num when num<20 then
21
1406
by: Martin Wells | last post by:
Someone posted the following excerpt recently in relation to the sizeof operator: 6.5.3.4p2: "... If the type of the operand is a variable length array type, the operand is evaluated; otherwise, the operand is not evaluated and the result is an integer constant." The first thing that occured to me was that nothing happens when you evaluate a VLA. I mean what's the following supposed to do?
18
7980
by: dspfun | last post by:
Hi! The words "expression" and "statement" are often used in C99 and C- textbooks, however, I am not sure of the clear defintion of these words with respect to C. Can somebody provide a sharp defintion of "expression" and "statement"? What is the difference between an expression and a statement?
7
1731
by: Charles Law | last post by:
This is a very basic question, but I can' turn up a statement on the subject: In C#, if I have If (x == 1 && y == 2) { .... }
0
9714
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10599
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10346
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10347
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10090
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9173
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6863
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.