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.
|