Query with edit state lazarus / 16-Databases ---------------------------------------------------------------------- daveinhull · 2018-12-01 08:56 Hi, Can anyone help or point me to some documentation. I have a DBGrid which is the only control. There is an Enter routine: 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 TForm1.DBGrid1Enter(Sender: TObject);begin  sqlQuery1.first;  sqlQuery1.edit ;  showstate(sqlquery1);end; Where showstate just goes to a function that converts the SQL state into a string and at this point it shows the state is EDIT. I then have an ColExit routine 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 TForm1.DBGrid1ColExit(Sender: TObject);begin  if DBGrid1.SelectedField.FieldName = 'FuelDate' then  begin    ShowState(sqlquery1);    DBGrid1.SelectedField.Value := '12/12/2018';  endend; The only thing I do once loaded is press Tab and the State is now shown as BROWSE in the ColExit routine. The Tab key should move it to the next cell. I can't figure out where or why it is going between Edit and Browse when only the Tab key is pressed. Any help would be most appreciated. Dave ---------------------------------------------------------------------- mangakissa · 2018-12-03 08:06 use TSQLQuery.state or TDatasource.state or TDBGrid.datasource.state ---------------------------------------------------------------------- daveinhull · 2018-12-03 23:45 Hi mangakissa, yes I use TSQLQuery.state in the show state routine that's how I know it changes state, but I can't figure out why its changing state? ---------------------------------------------------------------------- fpcoder · 2018-12-04 03:25 I think when tab is pressed the dbgrid calls Post. The query is returned to Browse state after a Post. Some talk about that here: http://www.festra.com/wwwboard/messages/2236.html ---------------------------------------------------------------------- mangakissa · 2018-12-04 07:27 There should be a real problem if the DBGrid.datasource.dataset is doing a post after each exit of the column. If the user is on the last column en uses tab, the record will be post autmatically because the cursor moves to another record. What would you do excactly when your exit the column. ---------------------------------------------------------------------- daveinhull · 2018-12-04 10:17 Thanks Kapibara for the link, looks a similar problem, but no final solution or reason given. Hi mangskissa, all I do is press tab with no other code events going on. I'll double check all options, but I think everything was just left as default.