Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Oct 2002
    New Salem, North Dakota, USA
    Thanked 0 Times in 0 Posts

    CODE Help!!! (2000)

    I need to get information from form back into a table. I need some help getting started. The form is doing some calculations that can not be done in a query....there would have to be numerous queries and I do not know how I would get the information out. I just need some ideas on how to get started....THANKS!!!!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: CODE Help!!! (2000)

    A. The general rule is: don't store calculated information in a table. There are at least two good reasons for this:
    1. <LI>It is redundant information that takes up unnecessary extra space in your database.
      <LI>If the data get updated outside your form, the calculated field(s) won't get updated, so they will contain inaccurate data.
    There are exceptions to this rule: it can be useful to store calculated data in a table if the calculations take an inordinate amount of time. So ask yourself whether you really need to store calculated data in your situation.

    B. You can perform complicated calculations in queries in Access, since you can use custom VBA functions. You can put the calculations in these custom functions.

    C. If you want to store something calculated on a form back into the underlying table, you can use the BeforeUpdate event of the form to do so. Say that you have a control txtMyField on the form that is bound to a field MyField in the the record source. Assign a value as follows:

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    ... ' Perform some calculations here.
    [txtMyField] = ... ' Assign the result of the calculation to txtMyField.
    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