Subject | RE: [IBO] Changing Grid cells automatically |
---|---|
Author | Roger Vellacott |
Post date | 2011-03-19T07:30:51Z |
Do it in the OnValidate method of the field.
Procedure TMyForm.QMyQueryDATE_1Validate(Sender:TField);
Begin
QMyQuery.FieldByName('DATE_2').AsDateTime := Sender.AsDateTime + 14;
End;
If field objects are created dynamically, set up the OnValidate in the AfterOpen of the query.
..
QMyQuery.FieldByName('DATE_1').OnValidate := QMyQueryDATE_1Validate;
Roger Vellacott
Hi, I have date fields in a Grid. If I add a new date in column1 then I want an updated date (i.e plus 2 weeks) to appear in column2.
How do I do this? Should I periodically just use a loop or is there a better way.
Terry
[Non-text portions of this message have been removed]
Procedure TMyForm.QMyQueryDATE_1Validate(Sender:TField);
Begin
QMyQuery.FieldByName('DATE_2').AsDateTime := Sender.AsDateTime + 14;
End;
If field objects are created dynamically, set up the OnValidate in the AfterOpen of the query.
..
QMyQuery.FieldByName('DATE_1').OnValidate := QMyQueryDATE_1Validate;
Roger Vellacott
Hi, I have date fields in a Grid. If I add a new date in column1 then I want an updated date (i.e plus 2 weeks) to appear in column2.
How do I do this? Should I periodically just use a loop or is there a better way.
Terry
[Non-text portions of this message have been removed]