Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1. Monthly (Recurring) Target: $300 :: Achieved: $95
      Become a Supporter    ::   Make a Contribution   

IIf statement?

Discussion in 'Information Technology' started by fox, Nov 11, 2005.

Tags:
  1. fox

    fox
    Expand Collapse
    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)
     
  2. Loading...


  3. Dirk Goldgar

    Dirk Goldgar
    Expand Collapse
    Guest

    "fox" <fox@discussions.microsoft.com> wrote in message
    news:878007C9-9A17-4E84-B407-99C0DD19E94A@microsoft.com
    > 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)
     
  4. fox

    fox
    Expand Collapse
    Guest

    No, Expression Builder still won't accept the change.

    BTW, I use Aceess 2000.

    "Dirk Goldgar" wrote:

    > "fox" <fox@discussions.microsoft.com> wrote in message
    > news:878007C9-9A17-4E84-B407-99C0DD19E94A@microsoft.com
    > > 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)
    >
    >
    >
     
  5. Dirk Goldgar

    Dirk Goldgar
    Expand Collapse
    Guest

    "fox" <fox@discussions.microsoft.com> wrote in message
    news:28F16E24-2448-4B60-AB9D-EC2105E8A423@microsoft.com
    > No, Expression Builder still won't accept the change.
    >
    > BTW, I use Aceess 2000.
    >
    > "Dirk Goldgar" wrote:
    >
    >> "fox" <fox@discussions.microsoft.com> wrote in message
    >> news:878007C9-9A17-4E84-B407-99C0DD19E94A@microsoft.com
    >>> 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)
     
  6. fox

    fox
    Expand Collapse
    Guest

    In a report, textbox

    "Dirk Goldgar" wrote:

    > "fox" <fox@discussions.microsoft.com> wrote in message
    > news:28F16E24-2448-4B60-AB9D-EC2105E8A423@microsoft.com
    > > No, Expression Builder still won't accept the change.
    > >
    > > BTW, I use Aceess 2000.
    > >
    > > "Dirk Goldgar" wrote:
    > >
    > >> "fox" <fox@discussions.microsoft.com> wrote in message
    > >> news:878007C9-9A17-4E84-B407-99C0DD19E94A@microsoft.com
    > >>> 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)
    >
    >
    >
     
  7. Dirk Goldgar

    Dirk Goldgar
    Expand Collapse
    Guest

    "fox" <fox@discussions.microsoft.com> wrote in message
    news:93F98E75-A0DB-4A8C-BD8D-9A2CD702700F@microsoft.com
    > In a report, textbox
    >
    > "Dirk Goldgar" wrote:
    >
    >> "fox" <fox@discussions.microsoft.com> wrote in message
    >> news:28F16E24-2448-4B60-AB9D-EC2105E8A423@microsoft.com
    >>> No, Expression Builder still won't accept the change.
    >>>
    >>> BTW, I use Aceess 2000.
    >>>
    >>> "Dirk Goldgar" wrote:
    >>>
    >>>> "fox" <fox@discussions.microsoft.com> wrote in message
    >>>> news:878007C9-9A17-4E84-B407-99C0DD19E94A@microsoft.com
    >>>>> 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)
     
  8. fox

    fox
    Expand Collapse
    Guest

    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" wrote:

    > "fox" <fox@discussions.microsoft.com> wrote in message
    > news:93F98E75-A0DB-4A8C-BD8D-9A2CD702700F@microsoft.com
    > > In a report, textbox
    > >
    > > "Dirk Goldgar" wrote:
    > >
    > >> "fox" <fox@discussions.microsoft.com> wrote in message
    > >> news:28F16E24-2448-4B60-AB9D-EC2105E8A423@microsoft.com
    > >>> No, Expression Builder still won't accept the change.
    > >>>
    > >>> BTW, I use Aceess 2000.
    > >>>
    > >>> "Dirk Goldgar" wrote:
    > >>>
    > >>>> "fox" <fox@discussions.microsoft.com> wrote in message
    > >>>> news:878007C9-9A17-4E84-B407-99C0DD19E94A@microsoft.com
    > >>>>> 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)
    >
    >
    >
     
  9. Dirk Goldgar

    Dirk Goldgar
    Expand Collapse
    Guest

    "fox" <fox@discussions.microsoft.com> wrote in message
    news:72A7A9DA-4DA9-4400-A716-D6944CAB16C6@microsoft.com
    > 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?

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

    (please reply to the newsgroup)
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page