Mirror

How to determine if a field's value has actually changed before posting the new value (Views: 100)


Problem/Question/Abstract:

How to determine if a field's value has actually changed before posting the new value

Answer:

{ ... }
var
  sBeforeText: string;

  in the AfterEdit event of the table catch the value:

  SBeforeText := DataSet.FieldByName('Category').AsString;

  in the BeforePost or AfterPost Event(depending on your preference)you can compare the original with the current

  if (sBeforeText <> DataSet.FieldByName('Category').AsString) then
    ShowMessage('Different Values');

<< Back to main page