Having trouble with help attained

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

After viewing several comments of help to other users, I looked up Calculated
Fields on Mr. Browne's site. The code seems to work and calculate acurately,
but never stores the data into the table. This is my code. What am I doing
wrong?

Private Sub GrandTotal_AfterUpdate()
Me.GrandTotal = (Me.Tax + Inventory_Subform!Total)
End Sub

Private Sub Tax_AfterUpdate()
Call GrandTotal_AfterUpdate
End Sub

Thank you for your help
 
Diana said:
After viewing several comments of help to other users, I looked up Calculated
Fields on Mr. Browne's site. The code seems to work and calculate acurately,
but never stores the data into the table. This is my code. What am I doing
wrong?

Private Sub GrandTotal_AfterUpdate()
Me.GrandTotal = (Me.Tax + Inventory_Subform!Total)
End Sub

Private Sub Tax_AfterUpdate()
Call GrandTotal_AfterUpdate
End Sub

Wrong event. When you set a value in code the AfterUpdate does not fire. You
need to run the code either in BOTH the Update events of the operand controls or
in the BeforeUpdate of the form.
 
Diana,

You really should not attempt to store the results of any calculation in a
table. Doing so violates both 2NF and 3NF (second and third normal forms) of
database design. Consider what database design guru Michael Hernandez has to
say on this subject:

"The most important point for you to remember is that you will always
re-introduce data integrity problems when you de-Normalize your structures!
This means that it becomes incumbent upon you or the user to deal with this
issue. Either way, it imposes an unnecessary burden upon the both of you.
De-Normalization is one issue that you'll have to weigh and decide for
yourself whether the perceived benefits are worth the extra effort it will
take to maintain the database properly."

Source: Page 23 of the last download, available here:
http://www.datadynamicsnw.com/accesssig/downloads.htm
"Understanding Normalization by Michael Hernandez, November 2002"


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
_______________________________

:

After viewing several comments of help to other users, I looked up Calculated
Fields on Mr. Browne's site. The code seems to work and calculate acurately,
but never stores the data into the table. This is my code. What am I doing
wrong?

Private Sub GrandTotal_AfterUpdate()
Me.GrandTotal = (Me.Tax + Inventory_Subform!Total)
End Sub

Private Sub Tax_AfterUpdate()
Call GrandTotal_AfterUpdate
End Sub

Thank you for your help
 
Back
Top