Results 1 to 5 of 5
  1. #1
    kwettersten is offline Novice
    Windows 10 Access 2007
    Join Date
    Aug 2016
    Posts
    2

    Calculated Fields

    I am calculating fields in a table...adding five fields to a totals column...working great...EXCEPT it is randomly skipping rows! Thoughts?

  2. #2
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,706
    Two things.
    First, we need to see how you are doing this. Post your code.
    Second: It's usually not good practice to store totals in tables. You do it in queries and use the query as a source for forms, reports, etc.
    The reason it's not good practice is having to account for one of the five fields changing. Then your stored total is wrong.

  3. #3
    kwettersten is offline Novice
    Windows 10 Access 2007
    Join Date
    Aug 2016
    Posts
    2
    Quote Originally Posted by kwettersten View Post
    I am calculating fields in a table...adding five fields to a totals column...working great...EXCEPT it is randomly skipping rows! Thoughts?
    I am inserting a field by using the calculated fields drop down menu and adding the expression [field1] + [field2] + [field3] etc..... would love to do it in a query if I could figure out how....

  4. #4
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,706
    Code:
    SELECT nz([field1])+nz([field2])+nz([field3])+nz([field4])+nz([field5]) AS fieldTotal
    FROM tblYourTable;
    Above will do the job. Google 'Access query grid tutorial' see how Access QBE can help your build queries if you aren't familiar with that.
    The nz function will substitute zero for nulls in the query. Nulls are probably why you were skipping rows.
    Last edited by davegri; 08-04-2016 at 07:47 AM. Reason: added nz

  5. #5
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    Is the calculation your issue or the "EXCEPT it is randomly skipping rows"? If you use query davegri suggested it should not skip rows unless you have other criteria or linked tables you are dealing with.

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

Similar Threads

  1. calculated fields need help?
    By Roger in forum Access
    Replies: 1
    Last Post: 04-09-2014, 06:58 AM
  2. Replies: 12
    Last Post: 10-01-2013, 12:59 PM
  3. Calculated fields?
    By crcastilla in forum Queries
    Replies: 2
    Last Post: 10-31-2011, 09:30 AM
  4. Calculated fields
    By Madmax in forum Forms
    Replies: 1
    Last Post: 06-17-2011, 08:36 AM
  5. Calculated fields
    By graciemora in forum Forms
    Replies: 1
    Last Post: 02-04-2011, 06:07 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