I'm using DBGrid, dbf and DataSource just figured how to make so when removing a certain book only the ammount removes by 1. I have been stuck on a task to make 2 rows merge if theyre made identical for example if the books name is "Test" and i'd add another row with books anem "Test" it would merge and change the ammount of the book from 1 to 2 or 2 to 3 etc.
procedure TForm1.Button1Click(Sender: TObject);
begin
with dbgrid1.DataSource.DataSet do begin
Insert;
Edit;
DBGrid1.DataSource.DataSet.FieldByName('Nr.').AsInteger;
Fields.fieldbyname('Year').value := Edit1.Text;
Fields.fieldbyname('Author').value := Edit2.Text;
Fields.fieldbyname('Name').value := Edit3.Text;
Fields.fieldbyname('Ammount').value := Edit4.Text;
Post;
Next;
end;
end;
Gads - Year Autos - Author Nosaukums - BooksName Kopijas- Ammount