Welcome to SPN

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

Sign Up Now!

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)
     

Share This Page