Results 1 to 2 of 2
Thread: CODE Help!!! (2000)
2003-05-12, 19:10 #1
- 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!!!!
2003-05-12, 19:36 #2
- Join Date
- Mar 2002
- Thanked 29 Times in 29 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:
- <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.
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.