Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    IIF clause on a report (Access 2000)

    I have an unbound control on a report called SalePrice.I also have 3 controls called UnitPrice , Grossprice and size. I want to build an IIF clause with the fooloiwng condition : if size = 205 or 180 then SalesPrice = grossprice Else SalePrice = UnitPrice.How can i do that ?

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: IIF clause on a report (Access 2000)

    In the control source for Sale Price put this:

    = iif(([Size]=250) or ([Size]=180),[GrossPrice],[UnitPrice])
    Regards
    John



  3. #3
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: IIF clause on a report (Access 2000)

    Thank you for the reply.But i get the error "extra ) in the query expression" ?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: IIF clause on a report (Access 2000)

    Check your expression carefully. Did you notice that there are 2 opening parentheses (( after IIf in the expression John posted?

    You can also use
    <code>
    = IIf([Size]=250 Or [Size]=180,[GrossPrice],[UnitPrice])</code>

  5. #5
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: IIF clause on a report (Access 2000)

    Please do apologize me ! Your expression works ! When i copied your expression i forgot to copy the = sign and hence the error ? Now it is Ok !!!!
    Please do apologize me and thank you !!!

  6. #6
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: IIF clause on a report (Access 2000)

    Please do apologize me ! The expression works ! When i copied your expression i forgot to copy the = sign and hence the error Now it is Ok !!!!
    Please do apologize me and thank you !!!

  7. #7
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: IIF clause on a report (Access 2000)

    The IIF clause works,but i get results with more decimal places than 2, when i try to format the control,the results are not seen any more.If i place the decimal places to 2, this has no effect.Therefore i wll try another approach,
    but i think i will have to send another thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •