Go Up to Using Dataset Events
The OnCalcFields event is used to set the values of calculated fields. The AutoCalcFields property determines when OnCalcFields is called. If AutoCalcFields is
True, then OnCalcFields is called when
- A dataset is opened.
- Focus moves from one visual component to another, or from one column to another in a data-aware grid control and the current record has been modified.
- A record is retrieved from the database.
OnCalcFields is always called whenever a value in a non-calculated field changes, regardless of the setting of AutoCalcFields.
If AutoCalcFields is False, then OnCalcFields is not called when individual fields within a single record are modified.
When OnCalcFields executes, a dataset is in dsCalcFields mode, so you cannot set the values of any fields other than calculated fields. After OnCalcFields is completed, the dataset returns to