View Single Post
  #2 (permalink)  
Old August 30th, 2004, 10:54 AM
SGL SGL is offline
Registered User
 
Join Date: Aug 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

First, add a field to the appropriate table where you will store your calculated field.

Second, bind your calculated control field to that form.

Third, make that control calculated field locked.

Fourth, write a VBA procedure that does the calculation. For example:

Me!CalcField = Me!Cost - Me!Discount

Fifth, set before update events for each field used to do the calculation that call the procedure you wrote above.

Sixth, set the on enter event of the calculated field to also call that procedure and do the calcuation. This should be unnecessary but it is an extra safety step.
Reply With Quote