Lazarus and Access-Database lazarus / 63-Database ---------------------------------------------------------------------- schand99 · 2020-11-19 12:52 Hi, I have encountered a strange behaviour on Lazarus and MS Access database: I open a SQL Query which selects a number of records. On the open records I have to check each record for the content of a field. I do this within a repeat ... until loop: A error raises up when rSSQL.Next points to the last record into rSSQL, just befor rSSQL.EOF is true 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 ...rSSQL.open;if not rSSQL.EOF do begin   rSSQL.First;   repeat      ... do something       rSSQL.Next;   until rSSQL.EOF;end;  If in the same code I first point to the last records and after that I point to the first record, there is no error Is there anybody else having this problem? Or maybe someone who can explain this strange behavior? 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 ...rSSQL.open;if not rSSQL.EOF do begin   rSSQL.Last;           //  <- this one   rSSQL.First;   repeat        ... do something       rSSQL.Next;   until rSSQL.EOF;end; ---------------------------------------------------------------------- Zvoni · 2020-11-20 08:26 I remember having similiar issues with DAO/ADO on VB6, that i had to move to the last record, and then back to the first, because the EOF and/or recordcount wasn't set properly or something like that. ---------------------------------------------------------------------- wp · 2020-11-20 09:59 The attached demo does the same: it iterates through an Access-based dataset and counts the empty fields, and the error does not occur. What is different to your case? I could imagine that the fact that the query is attached to a DBGrid in my demo could cause .Last already being called. So, please give more details, or better: upload a simple compilable demo (only pas, lfm, lpi, lpr and database files, all in a common zip, like I did). ---------------------------------------------------------------------- Zvoni · 2020-11-20 10:05 Found something: http://allenbrowne.com/ser-29.html Look at Point 5. Sounds like your Problem