Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Feb 2002
    Location
    Chicago
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    put results of calculated field into table (2000)

    How can I put the results of a calculated field on a form into a field in the table that the form is based on?

    Thanks much.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: put results of calculated field into table (2000)

    In general, it is not advisable to store the result of a calculated field in a table, because
    <UL><LI>It's redundant
    <LI>It's independable - the stored calculated value may not be updated if the underlying data are modified through another means than the form[/list]But I admit that there are situations in which it is useful or necessary to store calculated values. In such cases, you can write code in the BeforeUpdate event of the form to do so. Let's say that you have a text box txtCalculated with a calculated value on the form, and a field StoredValue in the table. The code would look like this:

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    StoredValue = txtCalculated
    End Sub

  3. #3
    2 Star Lounger
    Join Date
    Feb 2002
    Location
    Chicago
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: put results of calculated field into table (2000)

    Thanks - I understand both the solution and the warning.

Posting Permissions

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