对应DataSource的DataChange事件中处理。procedure TForm1.DataSource1DataChange(Sender: TObject;
Field: TField);
begin
if Field=nil then
exit;
if not(Field.DataSet.State in dsEditModes) then
Exit;
//下面比较2个字段的值得 caption:=datetimetostr(now) //如 if (Field=DBEdit1Eh.Field) and (Field.Asdatetime>date) then
//showmessage('不可大于当前日期') // if (Field=DBEdit2Eh.field) and (not DBEdit1Eh.Field.IsNull) and (DBEdit2Eh.Field.AsDatetime >DBEdit1Eh.Field.AsDatetime ) then
// showmessage('不可大于开始日期')end;