Modifying Values before Saving Data

You can easily modify data before saving it in the database, such as when encrypting passwords and adding audit trail data to a record. The best way to modify data is before saving the data to the database. The Property Sheet, Actions group provides the ability to specify a formula to retrieve the value, modify it and save it into the appropriate database column.

Example

In the example below, a formula is specified for the phone number field to add a “+1” prefix if the country is USA.

= IF(CustomersRecordControl.Country.Text = "USA", "+1 ", "") + CustomersRecordControl.Phone.Text

A more complex example is where a prefix is appended if the phone number does not already start with a “+1”.

= IF(NOT(CustomersRecordControl.Phone.Text.StartsWith("+1")) AND CustomersRecordControl.Country.Text = "USA", "+1", "") + CustomersRecordControl.Phone.Text

See Also

Common Formula Examples