Results 1 to 4 of 4
  1. #1
    Sre is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    2

    Summing multiple "if" statements

    In my form I have 4 text boxes with "if" statements that returns a value if the user selects "issue" from a drop down menu. I would like to sum these values to a grand total.

    Text Box 1 - =IIf([Results Source Folder Audit]="Issue","5")
    Text Box 2 - =IIf([Results SCR Audit]="Issue","20")
    Text Box 3 - =IIf([Results RMAL Audit]="Issue","5")
    Text Box 4 - =IIf([Validation]="Issue","20")

    I would like to create a grant total of the above text boxes. I tried this "=Sum(IIf([Results Source Folder Audit]="Issue","5")+IIf([Results SCR Audit]="Issue","20")+IIf([Results RMAL Audit]="Issue","5")+IIf([Validation]="Issue","20"))" I get this value - 520520. Example, If Issue was selected in all 4 text boxes the grand total should show 50.



    Please help!!! Thanks in advance.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    you dont need any code.
    you have a table with the 'options' and their values the user can pick.

    [ISSUE], [valu]
    the user picks the 'issue' but the box fills in the bound column of value.

    zero vb code.
    summing is done in a query.


  3. #3
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    When you enclose numbers in quotes, they are treated as Text, not Numbers. So remove those quotes, i.e.
    Code:
    IIf([Results Source Folder Audit]="Issue",5)

  4. #4
    Sre is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    2
    Quote Originally Posted by JoeM View Post
    When you enclose numbers in quotes, they are treated as Text, not Numbers. So remove those quotes, i.e.
    Code:
    IIf([Results Source Folder Audit]="Issue",5)
    JoeM - Thank you that worked!!!!!

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

Similar Threads

  1. Coding for 64 and 32 bit "if statements"
    By Silvera in forum Programming
    Replies: 2
    Last Post: 06-26-2015, 11:02 AM
  2. Replies: 1
    Last Post: 09-03-2014, 03:27 AM
  3. A Summing "Heirachy"
    By michaelh93 in forum Access
    Replies: 4
    Last Post: 01-16-2013, 08:30 PM
  4. Replies: 11
    Last Post: 03-29-2012, 02:32 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