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 calculating fields in a table...adding five fields to a totals column...working great...EXCEPT it is randomly skipping rows! Thoughts?
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.
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....
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.Code:SELECT nz([field1])+nz([field2])+nz([field3])+nz([field4])+nz([field5]) AS fieldTotal FROM tblYourTable;
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
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.