After Add Record procedure lazarus / 16-Databases ---------------------------------------------------------------------- dsyrios · 2018-11-26 17:10 Hi, I need help using sqlite/zeos. I want... after add a record using only DBnavigator and if the result is OK, then run something like "procedure After_Add_Record;" p.s. I've allready try with DBnavigator and ZQuery events but without success, maybe the solution is combine them somehow. Win32/Laz1.8.2 ---------------------------------------------------------------------- GAN · 2018-11-26 23:00 Why don't make your own navigator? It's very simple and you control all. ---------------------------------------------------------------------- lucamar · 2018-11-26 23:14 If you want to react to changes in the data, use the events of the data source in YourDBNavigator.Datasource. The DBNavigator control is just a UI widget. Or make your own navigator, as GAN said ---------------------------------------------------------------------- BSaidus · 2018-11-27 08:40 Quote from: dsyrios on November 26, 2018, 06:10:27 pmHi, I need help using sqlite/zeos. I want... after add a record using only DBnavigator and if the result is OK, then run something like "procedure After_Add_Record;" p.s. I've allready try with DBnavigator and ZQuery events but without success, maybe the solution is combine them somehow. Win32/Laz1.8.2 Why not use AfterPost event of dataSet (Query or Table) Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TMyForm.qryListClientsAfterPost(DataSet: TDataSet);begin  // put here your code .....end; ---------------------------------------------------------------------- dsyrios · 2018-11-27 19:00 Thanks all for your answers. @Gan... It's for an old existing code and it's difficult for me to change it. @Lucamar & @ BSaidus... I've tried, but I failed. I attach a very simple project to understand the procedure that I need. ---------------------------------------------------------------------- HeavyUser · 2018-11-27 20:44 Quote from: dsyrios on November 27, 2018, 08:00:00 pmThanks all for your answers. @Gan... It's for an old existing code and it's difficult for me to change it. @Lucamar & @ BSaidus... I've tried, but I failed. I attach a very simple project to understand the procedure that I need. as far as I can see from the code posted the afterscroll event is called after inserting / appending a new record but before the user selects the post or cancel actions. This means that the check of known record count and new record count will always be the same on the after post event. try to remove the check from the CheckChangeRecs method and only call CheckChangeRecs from the afterpost event only. ---------------------------------------------------------------------- dsyrios · 2018-11-28 02:48 @HeavyUser Thanks for your attention,  The code is demo, I agree/know that AfterScroll() is useless for the main problem,  it's just only a way to update the ComboBox.Text  The main problem is to have the deleted or new record,  so that I can remove it or add it to the ComboBox.Items.  I've try to catch something like  TUpdateKind = (ukModify, ukInsert, ukDelete)  and combine with AfterPost() or BeforePost() event, but I failed. ---------------------------------------------------------------------- HeavyUser · 2018-11-28 03:00 Quote from: dsyrios on November 28, 2018, 03:48:41 am@HeavyUser Thanks for your attention,  The code is demo, I agree/know that AfterScroll() is useless for the main problem,  it's just only a way to update the ComboBox.Text  The main problem is to have the deleted or new record,  so that I can remove it or add it to the ComboBox.Items.  I've try to catch something like  TUpdateKind = (ukModify, ukInsert, ukDelete)  and combine with AfterPost() or BeforePost() event, but I failed. so? Doesn't any of my recommendations work? ---------------------------------------------------------------------- mangakissa · 2018-11-28 07:51 Quote from: dsyrios on November 28, 2018, 03:48:41 am The main problem is to have the deleted or new record,  so that I can remove it or add it to the ComboBox.Items.  I've try to catch something like  TUpdateKind = (ukModify, ukInsert, ukDelete)  and combine with AfterPost() or BeforePost() event, but I failed. Read the post of BSaidus. For deleting record use the BeforeDelete and AfterDelete events to modify the combobox. For modifying /adding records use AfterPost event. TCombobox.items.indexof() is your best friend. TUpdatekind has nothing to do in this case. ---------------------------------------------------------------------- dsyrios · 2018-11-28 16:18 Thank you all for your help,  maybe I wasn't so clear  the solution to my problem is to replace the class of the TComboBox to TDBLookupComboBox,  but WITHOUT affection to the datasource I use...      DataSource :=nil;      DataField :='';  so I have an updating list at the box.  Now I'll try to apply this to my main project.  thanks again  p.s. I attach the new simple demo