Reputation: 75
So I am having a dbgrid that is used as a data entry. Assume I got 4 fields that needed to be filled by user and another field that I need to assign a value into. Look at the picture.
I connected that dbgrid to query1 through datasource1. my question is, how did I assign a certain value (ex:abc) to idpay field so that it will be read without user inputing it? As dbgrid is automatically posted, I need to assign that value on event beforepost. any idea how to do that? any help is much appreciated! Thank you!
Upvotes: 0
Views: 766
Reputation: 12014
Does the Query component you use has the AfterInsert event ?
If so than simply do something like this
procedure TForm1.ClientDataSet1AfterInsert(DataSet: TDataSet);
begin
DataSet.FieldByName('IDPAY').AsString := 'ABC';
end;
Upvotes: 1