Results 1 to 6 of 6
  1. #1
    pdlecesne is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2013
    Posts
    12

    Problem with Calculation on Report using IIF

    I have created a report that calculates two sets of ratios. The following code is not calculating properly:



    =IIf([CMINORM2YR]="0",[GPRAANORM2YR],([GPRAANORM2YR]/[CMINORM2YR]))

    I am trying to get it to return the previously calculated value if the value of CMINORM2YR is a #error or 0 value. What am I doing wrong? I get #Error messages with this formula.

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Try removing the quotes around 0.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    pdlecesne is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2013
    Posts
    12
    Thank-you but that did not help.

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Also make sure no textbox has the same name as any of the fields in the formula.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    qa12dx is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    india
    Posts
    112
    u have null value in numeric field.
    - in table prop, set the default value for the field to 0.
    - run a update qry to set nulls to 0.
    now ur statement will work. (remove quotation marks around numeric vals)

  6. #6
    pdlecesne is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2013
    Posts
    12
    Problem solved. Thanks!

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

Similar Threads

  1. Report Calculation
    By Azeez_Andaman in forum Reports
    Replies: 7
    Last Post: 10-08-2011, 11:58 PM
  2. Another calculation problem
    By stryder09 in forum Access
    Replies: 8
    Last Post: 03-08-2011, 03:11 PM
  3. another calculation problem
    By stryder09 in forum Access
    Replies: 15
    Last Post: 02-11-2011, 04:53 PM
  4. Calculation problem
    By cometdragon in forum Queries
    Replies: 2
    Last Post: 07-28-2010, 08:54 PM
  5. Report Calculation
    By thestclair in forum Reports
    Replies: 2
    Last Post: 03-28-2006, 12:23 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