Storing Unbound information in a table

J

Jody K

I have a database that has an unbound field that has a control source that is
an expression. I want the result of the expression stored in the table. Is
this possiable? Please bear with me i am fairly new at this.

I am using Acess 2003 if this helps.

Thanks,
Jody K
 
R

Rick B

If it is an expression, then you probably don't need to store it. This is
typically done for a "calculated" value. It typically combines or performs
math on data already in the table.

To store the new "calculated" value would be redundant. If it uses data
already stored in the underlying table, then you don't need to store it
again. What if one of the underlying values changes? What would remind you
to go update the combined field as well?

When you need that "calculated" value, simply create it in your queries,
reports, and forms.

Post back a specific example if you need more help, or if this does not use
data that is already stored in your table.
 
R

Rick Brandt

Jody said:
I have a database that has an unbound field that has a control source
that is an expression. I want the result of the expression stored in
the table. Is this possiable? Please bear with me i am fairly new at
this.

I am using Acess 2003 if this helps.

Thanks,
Jody K

It's possible, but it's wrong to do so. Data that can be calculated should
not be stored. Just put your expression in a query and use the query
instead of the table.
 
O

Ofer

It is not recomnded to save a calculated field in a table, you can always use
the expression to display the value. Storing it in a table mean that you need
to maintain it.
If you want to save it anyway, if the form is bounded to the table you want
to update, create a field in the form, bounded to the field in the table, not
visible, and on the unload event of the form assign the value from the
expression field to the real field
Me.RealFieldName = Me.ExpressionFieldName

The other option will be, to use an update query, to update the field in the
write record
 
J

Jody K

Rick,
You are correct it would be redundant information. But if I could store this
information in the table it would make a complicated report very simple. What
I have is 20 forms that each have queries and all information is stored in
one table. Once you enter the information once it never changes. This
information is used to track unit downtime. The calculation adds the downtime
(which is in minutes) and then subtracts it by 720 minutes which gives us the
amount of uptime. This number (Uptime) is the number that I would like to
store in the table. I would like to have it stored from the unbound field
rather than have the operators retype it. I have entered this expression in
the query that is linked to the form but when I open the form it is blank.
 
R

Rick Brandt

Jody said:
Rick,
You are correct it would be redundant information. But if I could
store this information in the table it would make a complicated
report very simple. What I have is 20 forms that each have queries
and all information is stored in one table. Once you enter the
information once it never changes. This information is used to track
unit downtime. The calculation adds the downtime (which is in
minutes) and then subtracts it by 720 minutes which gives us the
amount of uptime. This number (Uptime) is the number that I would
like to store in the table. I would like to have it stored from the
unbound field rather than have the operators retype it. I have
entered this expression in the query that is linked to the form but
when I open the form it is blank.

So I would suggest the following...

Rename your table "TableName_Src"
Build a query named "TableName"

The query is simply a SELECT of all fields from TableName_Src except that
you add a calculated field using the expression you currently have on the
form.

Since you have given the query the same name that your table used to have
all forms and reports work without modification and the calculated field
will simply be there (and work automatically).
 
Top