Topic: 2 scripting questions.

How to write script that automatically sets the current date in field "DateOfChange" when one of the fields in that record was changed. ?

Another one:
How to prevent some fields in a form from being changed, depending on the value of a specific field in that form.

Re: 2 scripting questions.

flying2birds wrote:

How to write script that automatically sets the current date in field "DateOfChange" when one of the fields in that record was changed. ?

procedure Form2_Edit1_OnKeyPress (Sender: string; var Key: Char);
begin
     Form2.DateTimePicker1.DateTime := now;
end;

procedure Form2_Edit2_OnKeyPress (Sender: string; var Key: Char);
begin
     Form2.DateTimePicker1.DateTime := now;
end;


flying2birds wrote:

Another one:
How to prevent some fields in a form from being changed, depending on the value of a specific field in that form.

procedure Form2_ButtonSave_OnClick (Sender: string; var Cancel: boolean);
begin
     if Form2.Edit1.Text = 'Hello' then 
     begin
         ShowMessage('You can't write here word Hello');         
         Cancel := True;
     end;
end;
Dmitry.