How do i sum fields in a record?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I have a database created in Office 2003 in which I need to total
amounts in various fields within a record. I cant seem to get it to work.
Can anyone help?

Thanks
 
Just add an unbound control in your forms or reports such as:

=[Field1]+[Field2]+[Field3]...

To do so in a query, add anew column such as...

NewFieldName: [Field1]+[Field2]+[Field3]...
 
Hi, I have a database created in Office 2003 in which I need to total
amounts in various fields within a record. I cant seem to get it to work.
Can anyone help?

Thanks

As suggested, a calculated field in a Query like

SumOfFields: [Field1] + [Field2] + [Field3]

is a start. Note that this sum cannot be calculated (and should not be
stored) in a Table; use a dynamic calculation in a query instead.

If any of the fields might be NULL, you'll get NULL as the sum. To
solve this use

SumOfFields: NZ([Field1]) + NZ([Field2]) + NZ([Field3])

instead of the simpler expression - the NZ (Null To Zero) function
will convert null (unknown, undefined) values to 0.

John W. Vinson[MVP]
 
Thanks, I'll give that a try

John Vinson said:
Hi, I have a database created in Office 2003 in which I need to total
amounts in various fields within a record. I cant seem to get it to work.
Can anyone help?

Thanks

As suggested, a calculated field in a Query like

SumOfFields: [Field1] + [Field2] + [Field3]

is a start. Note that this sum cannot be calculated (and should not be
stored) in a Table; use a dynamic calculation in a query instead.

If any of the fields might be NULL, you'll get NULL as the sum. To
solve this use

SumOfFields: NZ([Field1]) + NZ([Field2]) + NZ([Field3])

instead of the simpler expression - the NZ (Null To Zero) function
will convert null (unknown, undefined) values to 0.

John W. Vinson[MVP]
 
Thanks for your help

Rick B said:
Just add an unbound control in your forms or reports such as:

=[Field1]+[Field2]+[Field3]...

To do so in a query, add anew column such as...

NewFieldName: [Field1]+[Field2]+[Field3]...


--
Rick B



JEK1978 said:
Hi, I have a database created in Office 2003 in which I need to total
amounts in various fields within a record. I cant seem to get it to work.
Can anyone help?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top