How to create a field in a table whose value will be calculated

S

Slipperyrock

I could use some help in creating a field in a table the value of which would
be the continuing balance of simple arithmetic operations such as:

T(n) = T(n-1) A(n) - S(n) where T=Total, A=value in a field to be added,
S=value in a field to be subtracted, and n=record number

Does this make sense?
 
G

Gina Whipp

Slipperyrock,

If I understand you correctly you want a calculated field in a table...
that would be a no can do BUT you can do it in a query. Now, you can
simulate a table view using a query and a form.

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

I could use some help in creating a field in a table the value of which
would
be the continuing balance of simple arithmetic operations such as:

T(n) = T(n-1) A(n) - S(n) where T=Total, A=value in a field to be added,
S=value in a field to be subtracted, and n=record number

Does this make sense?
 
J

John W. Vinson

I could use some help in creating a field in a table the value of which would
be the continuing balance of simple arithmetic operations such as:

T(n) = T(n-1) A(n) - S(n) where T=Total, A=value in a field to be added,
S=value in a field to be subtracted, and n=record number

Does this make sense?

No, not in a relational database.

Storing derived data such as this in your table accomplishes
three things: it wastes disk space; it wastes time (almost
any calculation will be MUCH faster than a disk fetch); and
most importantly, it risks data corruption. If one of the
underlying fields is subsequently edited, you will have data
in your table WHICH IS WRONG, and no automatic way to detect
that fact.

Just redo the calculation whenever you need it, either as a
calculated field in a Query or in the control source of a Form or a Report
textbox.

And there *are* no "record numbers" in a relational table, other than record
numbers that you create and maintain yourself.
 

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

Top