Results 1 to 7 of 7
  1. #1
    LanieB is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    54

    IIF Statement not working...

    I am creating a database to store audit scores
    There is a section of Bonus Points. So obviously the points AVAILABLE will always be 0. When showing these results on a report I want to see (on average) how many people actually score bonus points. This is the statement I am using...



    DO_Green_AA = Points Available
    DO_Green_AE = Points Earned

    *Thinking Green*: IIf([DO_Green_AA]=0,2,[DO_Green_AE]/[DO_Green_AA])

    I thought this would be telling the equation to change any 0 in the available column to a 2... did I not write it correctly?

  2. #2
    LanieB is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    54
    Is the statement I have written up there saying If DO_Green_AA is 0, change it to a 2...?

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    No.
    *Thinking Green*: IIf([DO_Green_AA]=0,2,[DO_Green_AE]/[DO_Green_AA])
    *Thinking Green*: represents a field name (bad use of *)

    This is saying,
    if [DO_Green_AA]=0 then *Thinking Green* will be valued 2
    otherwise *Thinking Green* will be valued [DO_Green_AE]/[DO_Green_AA]

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I am confused. If Points Available will always be 0 why are you dividing by Points Available?

    [DO_Green_AE] / IIf([DO_Green_AA]=0,2,[DO_Green_AA])

    Should avoid special characters (* @ # $ % & / + - < >), punctuation (underscore is exception), spaces in names or reserved words as full names. If used must enclose in [].
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    LanieB is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    54
    They want to be able to see on the report the average of people that actually got bonus points.

    How would I write the equation to change a 0 to a 2? I see now what you are saying with my previous IIF statement.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I gave you the expression. Is it working as you expect?

    Dividing points earned by points available will give average of people that got bonus points? Not really following that but if it is what you want...
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    LanieB is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    54
    I got this figure out! Thank you so much for all of your help!~

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

Similar Threads

  1. Replies: 1
    Last Post: 07-30-2011, 07:58 AM
  2. "Or" not working in if statement
    By degras in forum Programming
    Replies: 0
    Last Post: 04-19-2011, 05:00 AM
  3. Delete SQL statement not working properly
    By Alexandre Cote in forum Programming
    Replies: 3
    Last Post: 10-18-2010, 12:56 PM
  4. Textbox IIF statement not working
    By jgelpi16 in forum Forms
    Replies: 2
    Last Post: 08-22-2010, 08:41 PM
  5. Replies: 2
    Last Post: 06-14-2010, 09:38 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