473,432 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,432 software developers and data experts.

Iif Statement - Operand Error

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

Iif([Branch]="580" OR "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))

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

Charge:Iif(...code 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 1866
missinglinq
3,532 Expert 2GB
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 Expert 1GB
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 Expert 100+
I have attempted to use the following IIF statement in a query, with no success.

Iif([Branch]="580" OR "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))

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

Charge:Iif(...code 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 Expert 1GB
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 Expert 2GB
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 Expert 100+
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
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....
35
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...
3
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...
15
by: Nerox | last post by:
Hi, If i write: #include <stdio.h> int foo(int); int main(void){ int a = 3; foo(a); }
6
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...
7
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
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,...
18
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...
7
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) { .... }
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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,...
0
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...
0
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...
0
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...
0
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...
0
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.