Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2004
    Posts
    2

    Wink Unanswered: calculations on a form

    I have a form that contains this information
    [actualcnp]
    [plancnp]
    and an unbound field called text12 that is =[actualcnp]/[plancnp]
    [actualns]
    [planns]
    and an unbound field called text 16 that is =[actualns]/[planns]

    what I need is another field called text18 that would contain a calculation that would do this:

    if the value of text 12 is between 98-99 and the value of text16 is between 100-101 then text18 =50%
    else if the value of text 12 is between 100-101 and the value of text16 is between 102-103 then text18 =100%

    thanks

  2. #2
    Join Date
    Apr 2003
    Location
    Alabama, USA
    Posts
    154
    Set the Control Source for text18 to the formula below.

    =IIf([text12] Between 98 And 99 And [text 16] Between 100 And 101,"50%",IIf([text 12] Between 100 And 101 And [text 16] Between 102 And 103,"100%","Doesn't match either condition.."))

    If you are wanting a value of 50% and not the text 50%, replace 50% with 0.5 and format the new textbox as Percentage.

    I would also like to suggest that you name your textboxes with something meaningful rather than text12, something like txtPercentage or txtRatio. Will go a long way to helping you out if you ever need to use code in your form.

    Hope that is what you are looknig for.
    Last edited by Cosmos75; 06-08-04 at 17:00.
    http://AccessDB.Info

    You live and learn. At any rate, you live. - Douglas Adams

  3. #3
    Join Date
    Jun 2004
    Posts
    2
    You are my hero a thousand thank yous

  4. #4
    Join Date
    Apr 2003
    Location
    Alabama, USA
    Posts
    154
    Quote Originally Posted by lauren6903
    You are my hero a thousand thank yous
    Aw. shucks...


    lauren6903,
    You are very welcome! Glad to be of help!
    http://AccessDB.Info

    You live and learn. At any rate, you live. - Douglas Adams

Posting Permissions

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