does Locate have a next/prev funtion lazarus / 16-Databases ---------------------------------------------------------------------- WTDdallas · 2016-07-28 15:21 I am doing a lookup in a dataset using Locate, Work great but, There are more that one entry that match the search. Is there a way to do a locate.next or locate.prev ? ---------------------------------------------------------------------- Handoko · 2016-07-28 15:57 So far as I know TDBF.Locate doesn't support Next and Prev. But it can be achieved by using TStrings. Use Locate to get the results and save it to TString. Other way to do it is to create your own Singly Linked List or Doubly Linked List data structure to store the results. It's probably the hardest way. But if you've done it, you'll be happy because you have programmed something that is very complicated. ---------------------------------------------------------------------- Thaddy · 2016-07-28 15:57 Locate is standard - in its base functionality only - unidirectional so subsequent locate calls (depending on locate options, maybe increase recno by 1 in dbf) should find the next. Just try it. If there is an index, though, locate uses the index and this scheme won't work. Normally you would simply write an Sql  select query, but if that is not present? ---------------------------------------------------------------------- antelove19 · 2016-07-28 17:31 if ADOQuery1.Locate('time', timeday,[])  then   begin            DataModule1.ADOQuery1.MoveBy(1);           //DataModule1.ADOQuery1.Next;   end; ---------------------------------------------------------------------- mangakissa · 2016-08-03 06:17 dataset.MoveBy is doing the same as dataset.next ---------------------------------------------------------------------- mariodosreis · 2016-08-24 13:37 Try this:       //It works most of the times       mykey:= #xyz ; // Some Key       If tdDbf1.Locate... Then        With tdDbf1 Do         While ((tdDbf1.FieldByName('Key').As...=myKey) and Not (tdDbf1.Eof)) Do         begin          // If Index KEY is "Ascending"           tdDbf1.Next;          (// OR: If Index KEY is "Descending"           tdDbf1.Previous ; ) // depending on what are your needs...         end;       You also have tbClientes.MoveBy(...); i don't know if it suit's your needs.  I gess not!? I hope it help's B.Regards Mário ---------------------------------------------------------------------- ahiggins · 2016-08-24 16:34 What DB are you using? if you are using TDbf then you could use a filter or SetRange (index required) then just use Next/Prev kind regards Tony