Subject Duplicate a record
Author Harald Klomann
Hi,

I want to append a new record, with the all the values assigned from the current record in a grid.
My code works, but is there a better method to do this ?


procedure TfrmDemo.Button1Click(Sender: TObject);
var i:integer;
begin
with IB_Query1 do begin
i := FieldByName('ID').AsInteger;
Append;
KeyFields.ByName('ID').AsInteger := i;
if LookupKeyForBufferFields then begin
for i := 0 to FieldCount-1 do Fields[i].Assign(BufferFields[i]);
post
end;
end;
end;


Thanks
Harald Klomann