IIf statement?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a IIf statement. Now I want to add some limit, but it won't accept it.
Could someone tell me where is wrong? Or I can't use it like that? Thank you.
Current:
Sum(IIf([Fail]>4,1,0))
New: (If Type = AAA or BBB, Check the fail)
Sum(IIf([Type] = "AAA" Or [Type] = "BBB"), IIf([Fail]>4,1,0),0)
 
fox said:
I have a IIf statement. Now I want to add some limit, but it won't
accept it. Could someone tell me where is wrong? Or I can't use it
like that? Thank you. Current:
Sum(IIf([Fail]>4,1,0))
New: (If Type = AAA or BBB, Check the fail)
Sum(IIf([Type] = "AAA" Or [Type] = "BBB"), IIf([Fail]>4,1,0),0)

I see errors in your parentheses. Try this:

Sum(IIf([Type] = "AAA" Or [Type] = "BBB", IIf([Fail]>4,1,0),0))
 
No, Expression Builder still won't accept the change.

BTW, I use Aceess 2000.

Dirk Goldgar said:
fox said:
I have a IIf statement. Now I want to add some limit, but it won't
accept it. Could someone tell me where is wrong? Or I can't use it
like that? Thank you. Current:
Sum(IIf([Fail]>4,1,0))
New: (If Type = AAA or BBB, Check the fail)
Sum(IIf([Type] = "AAA" Or [Type] = "BBB"), IIf([Fail]>4,1,0),0)

I see errors in your parentheses. Try this:

Sum(IIf([Type] = "AAA" Or [Type] = "BBB", IIf([Fail]>4,1,0),0))


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
fox said:
No, Expression Builder still won't accept the change.

BTW, I use Aceess 2000.

Dirk Goldgar said:
fox said:
I have a IIf statement. Now I want to add some limit, but it won't
accept it. Could someone tell me where is wrong? Or I can't use it
like that? Thank you. Current:
Sum(IIf([Fail]>4,1,0))
New: (If Type = AAA or BBB, Check the fail)
Sum(IIf([Type] = "AAA" Or [Type] = "BBB"), IIf([Fail]>4,1,0),0)

I see errors in your parentheses. Try this:

Sum(IIf([Type] = "AAA" Or [Type] = "BBB", IIf([Fail]>4,1,0),0))

Where are you trying to put this expression?
 
In a report, textbox

Dirk Goldgar said:
fox said:
No, Expression Builder still won't accept the change.

BTW, I use Aceess 2000.

Dirk Goldgar said:
I have a IIf statement. Now I want to add some limit, but it won't
accept it. Could someone tell me where is wrong? Or I can't use it
like that? Thank you. Current:
Sum(IIf([Fail]>4,1,0))
New: (If Type = AAA or BBB, Check the fail)
Sum(IIf([Type] = "AAA" Or [Type] = "BBB"), IIf([Fail]>4,1,0),0)

I see errors in your parentheses. Try this:

Sum(IIf([Type] = "AAA" Or [Type] = "BBB", IIf([Fail]>4,1,0),0))

Where are you trying to put this expression?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
fox said:
In a report, textbox

Dirk Goldgar said:
fox said:
No, Expression Builder still won't accept the change.

BTW, I use Aceess 2000.

:

I have a IIf statement. Now I want to add some limit, but it won't
accept it. Could someone tell me where is wrong? Or I can't use it
like that? Thank you. Current:
Sum(IIf([Fail]>4,1,0))
New: (If Type = AAA or BBB, Check the fail)
Sum(IIf([Type] = "AAA" Or [Type] = "BBB"), IIf([Fail]>4,1,0),0)

I see errors in your parentheses. Try this:

Sum(IIf([Type] = "AAA" Or [Type] = "BBB", IIf([Fail]>4,1,0),0))

Where are you trying to put this expression?

As the controlsource of a text box, you need to begin the expression
with an equals sign:

=Sum(IIf([Type] = "AAA" Or [Type] = "BBB", IIf([Fail]>4,1,0),0))

Forget the expression builder. If you copy and paste that into the text
box's ControlSource property, does it work?
 
No, it still wont change controlsource. Sorry, actually, it's more complex.
Here is the whole thing.

The original
=Count([Charge])-Sum(IIf([Fail]>4,1,0))-Sum(IIf([Type]<>"AAA" And
[Type]<>"BBB",1,0))
Here is the modified one.
=Count([Charge])-Sum(IIf([Type]="AAA" Or
[Type]="BBB",IIf([Fail]>4,1,0),0))-Sum(IIf([Type]<>"AAA" And
[Type]<>"BBB",1,0))


Dirk Goldgar said:
fox said:
In a report, textbox

Dirk Goldgar said:
No, Expression Builder still won't accept the change.

BTW, I use Aceess 2000.

:

I have a IIf statement. Now I want to add some limit, but it won't
accept it. Could someone tell me where is wrong? Or I can't use it
like that? Thank you. Current:
Sum(IIf([Fail]>4,1,0))
New: (If Type = AAA or BBB, Check the fail)
Sum(IIf([Type] = "AAA" Or [Type] = "BBB"), IIf([Fail]>4,1,0),0)

I see errors in your parentheses. Try this:

Sum(IIf([Type] = "AAA" Or [Type] = "BBB", IIf([Fail]>4,1,0),0))

Where are you trying to put this expression?

As the controlsource of a text box, you need to begin the expression
with an equals sign:

=Sum(IIf([Type] = "AAA" Or [Type] = "BBB", IIf([Fail]>4,1,0),0))

Forget the expression builder. If you copy and paste that into the text
box's ControlSource property, does it work?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
fox said:
No, it still wont change controlsource. Sorry, actually, it's more
complex. Here is the whole thing.

The original
=Count([Charge])-Sum(IIf([Fail]>4,1,0))-Sum(IIf([Type]<>"AAA" And
[Type]<>"BBB",1,0))

So the original worked?
Here is the modified one.
=Count([Charge])-Sum(IIf([Type]="AAA" Or
[Type]="BBB",IIf([Fail]>4,1,0),0))-Sum(IIf([Type]<>"AAA" And
[Type]<>"BBB",1,0))

Huh. I don't see anything wrong with that. That's an exact copy/paste
of what you're trying? What error message do you get?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top