Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Feb 2004
    Location
    Jacksonville, Florida
    Posts
    70
    Thanks
    0
    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?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 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]
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •