[solved] GoToBookMark after closing & opening Query lazarus / 16-Databases ---------------------------------------------------------------------- fpcoder · 2014-02-17 02:15 Can Query.GotoBookMark(aBookMark) be called after closing and opening the Query? Or will the bookmark pointer be outdated when the query is re-opened? I get a violation on trying this. ---------------------------------------------------------------------- taazz · 2014-02-17 06:08 Bookmarks must be handled as pointers after a dataset is closed they are probably invalid or pointing to the wrong record. In any case you need to find some other way to find your record, locate perhaps? ---------------------------------------------------------------------- JZS · 2014-02-17 12:27 BookMarks will keep giving you violation if your data has been manipulated or re-fetched. BookMarks as well as RecNo may not refer to the right records, IF, for instance, you are updating/deleting/reordering your records. Locate should be your best approach. ---------------------------------------------------------------------- fpcoder · 2014-02-18 02:21 Thanks. Locate seems to be the best choice to find a record after closing the query. If I understand correctly, Locate searches the result of a Query and finds the record you look for, if it exists. If the Query is assigned to a data aware control like a DBGrid, then the located record will automatically be the current record of the grid. And thats just whats needed. Example: aQuery.Locate('field_name', 'FieldValue', []);