Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

IIF and Sum on an Access report

  • 11-07-2005 3:04pm
    #1
    Registered Users, Registered Users 2 Posts: 420 ✭✭


    I am trying to get some info on an Access 2000 report that shows me the total value of customers who have paid for a product.
    The field which shows paid or not is a checkbox.

    I am trying to show:

    The number of units - =Count([Tester_ID])
    The total € of units ordered - =Sum([price])
    The number of units paid for - =Count(IIf([paid]="Yes",0))
    The total € of units paid for - =IIf([paid]="Yes",Sum([price]))


    This is all coming from a query which first filters by a month.
    The only field i cannot populate is the total € of units paid for.
    It looks like i am missing a false criteria but if i put
    =IIf([paid]="Yes",Sum([price]),0) the result is zero.
    I would just multiply units by a value but all the units are not standard price.

    Can anyone help me out on this hot day?


Comments

  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    I'm not sure if it'll let you do this but I think you want the SUM to be outside the IIF i.e.
    SUM(IIF([paid]="Yes",[price],0))


  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    Yup. Put the sum outside.

    Alternately, put the IIF into the Query, and just SUM the value in the report.


  • Registered Users, Registered Users 2 Posts: 420 ✭✭RustySpoon


    Thanks for the help, worked a treat :)


  • Registered Users, Registered Users 2 Posts: 1,393 ✭✭✭Inspector Gadget


    RustySpoon:

    In case you didn't spot it, Iif() takes three operators, not two:
    ReturnValue = IIf({expression to evaluate as boolean}, {return this if true}, {return this if false})
    

    Gadget


Advertisement