Results 1 to 9 of 9
  1. #1
    BEI77 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    May 2014
    Location
    KY
    Posts
    24

    Iif calculations in a form

    I have a field named SickDaysTaken and one named ExcessSickDays. I want to give 3 days of Sick Days with no penalty and I want the calculation to start
    adding to the ExcessSickDays field after the number 3 has been entered into SickDaysTaken.

    My thought is an expression for ExcessSickDays field would be

    IIF([SickDaysTaken]<=3,"0",IIF([SickDaysTaken]>3,[SickDaysTaken]*1))

    Any help appreciated, Thanks

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Don't make zero a string,,,just 0.
    you don't need '*1', just use [sickDaysTaken]

  3. #3
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,165
    Do you not have an extra IIF statement in there? Anything wrong with ExcessSickDays: IIF(SickDaysTaken<=3, 0, SickDaysTaken-3) ?

  4. #4
    BEI77 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    May 2014
    Location
    KY
    Posts
    24
    I get a syntax error when I try to save it.

  5. #5
    BEI77 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    May 2014
    Location
    KY
    Posts
    24
    kd2017 that worked, except I need it to subtract from the score. Up to 3 days is no points against them and will add to their score. Over 3 days will subtract from their score.

  6. #6
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,165
    Okay, I don't understand the full context of what you're trying to accomplish.

    SickDayScore: 3 - SickDaysTaken

  7. #7
    BEI77 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    May 2014
    Location
    KY
    Posts
    24
    Sorry

    SickDayScore if you take 3 days 3=3
    2=+1
    1=+2

    4=-1
    5=-2 ect.

  8. #8
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,165
    SickDayScore: IIF(SickDaysTaken <= 3, SickDaysTaken, 3 - SickDaysTaken)

    In this scenario Zero days taken equals zero add to score while 3 days taken equals 3 added to score. 3 sick days taken better than none?

  9. #9
    BEI77 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    May 2014
    Location
    KY
    Posts
    24
    I got it thanks all.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Calculations in a form
    By UT227 in forum Forms
    Replies: 7
    Last Post: 07-14-2016, 04:19 PM
  2. Replies: 30
    Last Post: 09-30-2015, 10:58 AM
  3. Form calculations
    By delta in forum Access
    Replies: 1
    Last Post: 07-27-2013, 10:16 AM
  4. Use a percentage for calculations on a form
    By nigelbloomy in forum Forms
    Replies: 3
    Last Post: 07-18-2013, 11:48 AM
  5. Calculations in a form
    By elmere in forum Forms
    Replies: 3
    Last Post: 04-27-2011, 04:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums