Hi! John
Actually I have a runningsum of profit or Loss per day in a text box on
the subform. I need that value to be added to the Capital on the main
form.
How do you use data from the subform to the main form and vice versa.
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 just as you're now doing it -
in the control source of a Form or a Report textbox.
You can use a Query (including a totals query) to calculate the
Capital value dynamically. That way you'll be sure it's right.
If you really want to refer to a mainform control on a subform, you
can use an expression
Parent!Controlname
To refer to a control on the *CURRENTLY SELECTED* record on a Subform
from an expression on the parent form, you can use
=subformcontrol.Form!controlname
where subformcontrol is the Name property of the "box" containing the
subform (this might be the same or different from the name of the form
within that control). Note that this will not pick up a running sum,
since you have no way of knowing which record on the subform has the
focus.
John W. Vinson[MVP]