Results 1 to 4 of 4
  1. #1
    Jaik is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    33

    IFF calculation on form



    Code:
    =(Nz([Payment],0)+Nz([Balance],0))*0.01
    So far I have calculation code like this. I am trying to add iif function to filter where Code column = SAVE


    =IIf([Code]="SAVE",Nz([Payment],0)+Nz([Balance],0)*0.01,0)

    So I have something like this, but I am getting weird numbers. However, Original calculation spits out right numbers.
    Is there any way to fix this problem?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    the brackets may be a problem,
    you must use the text box names on the form that have these values. (not field names, but they could be the same)

    =IIf(Code="SAVE",Nz(Payment)+Nz(Balance)*0.01,0)

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You have the parenthesis in the code box different than the calculation you typed in. Look close for the RED parenthesis

    Code:
    =(Nz([Payment],0)+Nz([Balance],0))*0.01
    Here you are adding [payment] and [balance], then multiplying the total by 0.01



    Code:
    =IIf([ Code ]="SAVE",Nz([Payment],0)+Nz([Balance],0)*0.01,0)
    Here you are multiplying [balance] by 0.01, THEN adding [payment] ....NO grouping parenthesis



    Try:
    Code:
    =IIf([ Code ]="SAVE",(Nz([Payment],0)+Nz([Balance],0))*0.01,0)
    This has the grouping parenthesis (in RED)




    Note: I had to add spaces around the word code because "code" is a tag in the HTML of the page. So ignore the extra spaces around code.

  4. #4
    Jaik is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    33
    Thanks guys for the help!

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

Similar Threads

  1. Form for calculation
    By kiranair in forum Forms
    Replies: 19
    Last Post: 08-10-2016, 01:51 AM
  2. Form Calculation is wrong!
    By Lou_Reed in forum Access
    Replies: 32
    Last Post: 08-04-2015, 02:16 PM
  3. Calculation Field in table vs Query calculation
    By Leonidsg in forum Database Design
    Replies: 18
    Last Post: 02-28-2013, 09:38 PM
  4. Access form calculation
    By MattyL in forum Access
    Replies: 8
    Last Post: 11-10-2011, 11:17 AM
  5. Calculation field in form
    By ste_pie87 in forum Access
    Replies: 1
    Last Post: 03-24-2009, 08:28 PM

Tags for this Thread

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