Arithmetic in a Table Row....

B

Big Gray Cat

Folks ---

I realize that this may be a ridiculous question, but after my first three
hours with
Access (I'm that new to it), I need to ask this....

I have two fields in a table. I want to add them together & put them in a
third field.
The addends are LONG INTEGERS.

I don't seem to be able to find anything in the <<!%!@!!!>> documentation.

How do I do this?

Thanks from The Big Gray Cat.
 
W

Wayne-I-M

No its not a silly question - things are only easy when you know.

To add 2 fields together
Create a query based on the table (there is a wizard for this)
Put this in the top row of a blank column

Result: [TableName]![FieldName] + [TableName]![FieldName]

Of course change the tableName and FieldName(s) to what they really are

Just a point - in access you use the table field to hold data and a query
form or report to do calculations and other "stuff"


Good luck
 
K

Ken Sheridan

Don't create a third field to hold the result. That introduces redundancy
which is 'a bad thing'. What you do is compute the result in a column in a
query. That way its always guaranteed to be correct. Open the query
designer and include your table. Include whatever columns (fields) you want
from the table in the design grid, and in the 'field' row of a blank column
enter something like this:

MyComputedField: [Field1]+[Field2]

When you open the query it will include a computed column named
MyComputedField containing the result of the addition. You can use the query
just as you would a table, e.g. as the RecordSource for a form or report, or
joined other tables or queries in another query, though its best to avoid too
many levels of queries within queries or you'll lose track.

Ken Sheridan
Stafford, England
 
R

Roger Carlson

You can't store formulas in a field. Access is not Excel. What you want to
do is create a Query and perform the calculation there. Now you'll be
thinking you want to *store* this number, but you don't. Although there are
a few cases where you want to store the result of a calculation, in most
cases you don't. Just run the query any time you want the value calculated.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Top