Results 1 to 7 of 7
  1. #1
    pshawk is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    6

    sum of columns dependant on other form answers

    i have a table and form set up for tracking requests for money. each person can request 5 times (on the same form) and each time the money may come from one of three accounts. the table is set up with value lists for the account names. so there is columns for

    account 1
    amount 1
    account 2
    amount 2


    etc

    i need to generate a report that sums the amount that has been requested of each account. i am at a loss on how to make this happen.

    i know the way to say it is

    Sum "amount 1" if account = "account name" + sum "amount 2" if account = "account name"

  2. #2
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    Code:
    Sum "amount 1" if account "account name" sum "amount 2" if account =  "account name" 
    makes no sense.

    Build the requisite value in an additional column using a conditional IIF if you recordsource (I assume you have a report); sum that column.

  3. #3
    pshawk is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    6
    thank you for replying, what would that look like? do i make a query with all of the fields and then a report off of the query?

    it has been a long time since i used access and i need it spelled out for me, thanks

  4. #4
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    It's a nested conditional iff.
    Code:
    iif(condition1,sum1,iif(condition2,sum2,"")) 

  5. #5
    pshawk is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    6
    do i need to bracket or quote the conditions

  6. #6
    pshawk is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    6
    do i do this in the report design view, if so is it in the footer or the detail.

  7. #7
    pshawk is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    6
    i kept google-ing and finally was able to figure it out

    sum(iif([fund 1]="soc",[amount 1],0)+iif([fund 2]="soc",[amount 2],0))

    luckily i figured out a better way to organize my tables so that there is a one to many relationship and now i dont have to repete the logic over and over again

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

Similar Threads

  1. Keying in Test Answers from Hard Copy
    By CityOfKalamazoo in forum Forms
    Replies: 4
    Last Post: 12-07-2009, 12:44 PM
  2. Noob needing answers
    By sartan2002 in forum Access
    Replies: 0
    Last Post: 10-13-2009, 08:39 AM
  3. Change the display of Yes/No answers
    By winter in forum Forms
    Replies: 2
    Last Post: 08-11-2009, 09:06 AM
  4. Adding Two Columns
    By arthura in forum Queries
    Replies: 6
    Last Post: 05-01-2009, 08:38 PM
  5. Continuous Subforms Filter Dependant Combo
    By BigBear in forum Forms
    Replies: 0
    Last Post: 04-19-2009, 08:13 AM

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