Results 1 to 5 of 5
  1. #1
    jeffj13 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2016
    Posts
    3

    Help with Access report that sums non zero values

    Hello,



    I am MS Access newbie and working with a set of reports that were created by someone else that are part of a crosstab query. I am trying to adjust one of the formulas in the report to sum the above rows in the report when that row meets a condition where it is greater than 0. Right now the formula is summing all of the above rows and reads as follows.

    =Sum(IIf(IsNull([MILES_DEST_ORIG]),0,[BA])) "MILES_DEST_ORIG" is basically the field that if it is greater than 0 I would like to sum all of the categories for that particular row. "BA" represents a column of data from the report that is generated from the crosstab query. As I mentioned right now it is basically just summing everything regardless if MILES_DEST_ORIG is 0 or not.

    Hopefully I have explained this fully. Any help is much appreciated!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,526
    build a query, Q1
    put in the fields you want and the sum and the criteria.
    save the query
    if you want non-zero items, make Q2 that uses Q1 and set the sum field <>0

    Q2 now has non-zero sums.
    you can even run a Dlookup on it if you need.

  3. #3
    jeffj13 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2016
    Posts
    3
    Quote Originally Posted by ranman256 View Post
    build a query, Q1
    put in the fields you want and the sum and the criteria.
    save the query
    if you want non-zero items, make Q2 that uses Q1 and set the sum field <>0

    Q2 now has non-zero sums.
    you can even run a Dlookup on it if you need.
    Thanks for your reply. Is there a way I could adjust that formula instead? I have about 18 reports that generate data from an existing query and a crosstab query. With time constraints I would rather adjust the formula on each rather than recreate these reports.

  4. #4
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    A query is the easiest way to solve this. How many times does this total appear on each report? In the query use parameters to match a key field on a form somewhere so that the same query can be used in all reports. Then in the control source use DLookup to get the value.

  5. #5
    jeffj13 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2016
    Posts
    3
    Quote Originally Posted by aytee111 View Post
    A query is the easiest way to solve this. How many times does this total appear on each report? In the query use parameters to match a key field on a form somewhere so that the same query can be used in all reports. Then in the control source use DLookup to get the value.
    It appears 18 times on the crosstab report and then once each on the other 18 reports. I assumed it was easy enough to change some of the language with this formula =Sum(IIf(IsNull([MILES_DEST_ORIG]),0,[BA])) to sum the values of BA where MILES_DEST_ORIG was greater than 0.

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

Similar Threads

  1. Query/Report with x/y axis and sums
    By robbeh in forum Queries
    Replies: 1
    Last Post: 03-23-2016, 11:41 AM
  2. Replies: 3
    Last Post: 11-26-2012, 01:24 PM
  3. Replies: 1
    Last Post: 03-23-2012, 09:45 AM
  4. Replies: 0
    Last Post: 02-28-2010, 08:35 AM
  5. Sums in Detail area of report
    By Rick West in forum Reports
    Replies: 2
    Last Post: 12-01-2009, 07:15 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