How can I change a field's value in Table 2 based on the condition that another field's value in Table 1 has been changed? One has to update the other. And same with emptying or deleting the field. Any code examples?
Emptying record is wrong way. If you deleting record from Table 1, you can use OnDelete trigger to delete record(s) in Table 2 (same way as Lefteyed wrote.
If it is 1:1 relationship between Table 1 and Table 2, you should use only one table with merged columns.
Answers
Field - OnValidate:
// Filter to get the right record to changes in table 2
// your filter -
// Change value
Table2.VALIDATE(Field, Value);
Table2.MODIFY(TRUE);
Thank you. But how can I empty a record in table 2 if a field has been emptied in table 1?
If it is 1:1 relationship between Table 1 and Table 2, you should use only one table with merged columns.
Field - OnValidate:
// Filter to get the right record to changes in table 2
// your filter -
// Change value
IF Value = '' THEN
Table2.VALIDATE(Field)
ELSE
Table2.VALIDATE(Field, Value);
Table2.MODIFY(TRUE);