Answer» Is there a way to store a displayed VALUE in a field that is the result of a calculation?
Thanks for any help offerred.Sure, define the table field and after the calculation, set the field value to the result.
It is not recommended you do this however. Better to recalculate the result on demand or use SQL to calculate the field to be used when needed.
Why is it necessary to store calculated fields in your database?
I'll try to explain this as BRIEFLY as I can.
This a database that, among other things, tracks children participating in a social service program. The children's birth dates are stored when those dates are known. SOMETIMES a staff member only has the age of the child and needs to estimate what the birth DATE might be.
On the Child Intake form, I created a pop up form that opens when staff clicks on a command button called "Estimated DOB Calculator." There are 3 fields on this form one of which is HIDDEN.
1. Start Date (This is the hidden field and defaults to today's date) 2. Staff enters the age in a field called "Child Age" (Referred to as "Text0" in the expression in #3.) 3. "FutureDate" is a field containing this expression (=DateSerial(Year([StartDate])-[Text0],Month([StartDate]),Day([StartDate])) This gives them the approximate DOB of the child.
Staff takes the results from field #3 and types it into a field on the intake form called "EstimatedDOB." Those are the values that are stored in the table. (Staff could do this in their heads but that's another story...)
I'm trying to figure out how to this calculation on the Child Intake form rather than the pop up and have the results from "FutureDate" transferred to the "EstimatedDOB" field in some way other than by having staff type it in. 1. put the "Text0" on ChildIntakeForm as unbound 2. create event "On Change" of Text0, and write the VBA code to: - calculate the estimated DOB = date-age - set childintakeform.estimateddob.value = calculated value above
|