Validate Related Textbox Fields and Display Custom Error Message

Many times, your application will need to validate related fields, for example to:

This validation formula for the “Validate when Saving record” event returns an error if the City field contains San Francisco and the Country field is anything other than USA.

= IF(CustomersRecordControl.City.Text = "San Francisco" AND CustomersRecordControl.Country.text <> "USA", "Conflicting choices for City and Country", "")

If the condition evaluates to true then an empty string (““) is returned, indicating the validation is successful and the record should be saved into the database.

See Also

Common Formula Examples