[SOLVED] Locate current record after refresh... lazarus / 16-Databases ---------------------------------------------------------------------- 1HuntnMan · 2026-01-13 14:52 Trying to return the record pointer back to the current record just posted. This doesn't error but just like doesn't execute: 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 TFrmClientsMgt.QryClientsAfterPost(DataSet: TDataSet);var  CurID : Integer;begin  //=> Move back to the saved record...  CurID:= DataSet.FieldByName('CUSTNO').AsInteger;  QryClients.Locate('CUSTNO',CurID,[]);end; ---------------------------------------------------------------------- CharlyTango · 2026-01-14 07:55 In my opinion the record pointer stays at the same position when posting data. Why should he move? Except when inserting data, the he should stay on the inserted record. but maybe Bookmarks could help ---------------------------------------------------------------------- Zvoni · 2026-01-14 08:59 Quote from: CharlyTango on January 14, 2026, 08:55:07 amIn my opinion the record pointer stays at the same position when posting data. Why should he move? Except when inserting data, the he should stay on the inserted record. but maybe Bookmarks could help Remember, that type TBookmark is deprecated/should not be used anymore. Use TBookmarkStr instead ---------------------------------------------------------------------- 1HuntnMan · 2026-01-28 20:33 I tried TBookmarkStr instead per Zvoni but check out the way I coded it. Laz is having a problem with AnsiString vs. Integer. 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 TFrmApptsMgt.QryApptsAfterPost(DataSet: TDataSet);{var  MyBookmark : TBookmarkStr;}begin  //MyBookmark:= QryAppts.Bookmark;  UpdateTTLAppts;  //=> Move to the previously saved record...  //QryAppts.GotoBookmark(MyBookmark);  //QryAppts.FreeBookmark(MyBookmark);end;  I commented out the lines so that app can compile. This errors because MyBookmark is assigned an integer value via the first line: MyBookmark:= QryAppts.Bookmark; But, my previous code works in an app I coded a couple of years ago???? ---------------------------------------------------------------------- 1HuntnMan · 2026-01-28 20:34 Also, the record pointer returns to BoF because I refresh after I Post... ---------------------------------------------------------------------- Sieben · 2026-01-29 11:08 That's the problem - Refresh occurs after AfterPost is executed. You need to place the Locate in AfterRefresh. ---------------------------------------------------------------------- 1HuntnMan · 2026-02-09 16:28 Okay, thanks all, moving that one line Locate to AfterRefresh!