Results 1 to 2 of 2
2004-02-23, 17:45 #1
- Join Date
- Feb 2004
- Jacksonville, Florida
- Thanked 0 Times in 0 Posts
calculating a form to save in a table (9.0/2000)
My friend is trying to build a formula with a text box. The text box is labeled % complete. In the control source, she has a formula that looks at a serier of option group boxes, and adds them up if they're checked. That works fine. However, when you go to the table, it do not save the data in the form (for the % complete box only) in the table. Is there away to make it so the table plugs the output of the form for % complete into the column labeled %complete in the table?
2004-02-23, 19:25 #2
- Join Date
- Mar 2002
- Thanked 28 Times in 28 Posts
Re: calculating a form to save in a table (9.0/2000)
A text box is bound to a field if the Control Source is the name of that field; if the Control Source is a formula, the text box is NOT bound to a field, i.e. the result of the calculation is not stored in the underlying table.
If the result depends on other fields in the underlying table, there is no reason to store it, since it is derived information. You can recalculate it every time in a query, or directly on a form or report.
If the result does not depend on other fields, you need a bit of VBA code to store it, for example in the Before Update event of the form. The exact code depends on the field names and the calculation, but the general idea is
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.[PercentCompleteField] = Me.[CalculatedTextBox]