Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    May 2001
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Conditional display in report (2000)

    I am a novice, and have a problem that I would appreciate any help on. I have a control on a report which is the sum of several other controls. What I would like to do is to limit the displayed results in the calculated control to numbers between 0 and 12 (e.g., if the sum is "-3", the result displayed would be "0" or if the sum is "16" , the displayed result would be "12"). Thanks in advance.

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Conditional display in report (2000)

    You can use an Immediate IF statement in the calculated control. Something like the following should work:<pre>=IIF([Control1]+[Control2]+[Control3]...(etc.)>12,12,[Control1]+[Control2]+[Control3]...(etc.))</pre>

    HTH <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>

  3. #3
    New Lounger
    Join Date
    May 2001
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Conditional display in report (2000)

    Mark,

    Thank you fro your prompt suggestion. I have tried unsuccessfully to implement it. Would you give me a little more of your time?

    Here is the calculated control (abbreviated) :

    =[1HA]+[2HA]+[3HA]-12

    As you may recall I wish to ensure that if the calculated result is greater than 12, the number 12 is inserted in the control.

    Thanks, again,

    Gary

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Conditional display in report (2000)

    How abbreviated? Are you using an IIF statement? The IIF statement is what let Access know to decide between the calculated value and the number 12.

    This should work (pay special attention to the appropriately placed commas):
    =IIF([1HA]+[2HA]+[3HA]>12,12,[1HA]+[2HA]+[3HA])

    You may want to consult the Access helpfiles for the Immediate IF statment (IIF)

    HTH <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>

  5. #5
    New Lounger
    Join Date
    May 2001
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Conditional display in report (2000)

    Mark,

    Thanks for your help! It works like a charm now that I removed an extra ")" that I had included.

    Gary

Posting Permissions

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