Jasonjac2 0 Posted February 25 Following on from the linked question. I have put some debug code in to try and optimize the locate - see below. procedure TfrmMain.FDBatchMove1FindDestRecord(ASender: TObject; var AFound: Boolean); begin mmInfo.lines.Add('Find: src.ID: '+tblsrcWebUsersid.AsString+' current dest.id: '+tbldestWebUsersid.AsString); afound:=(tblsrcWebUsersID.value = tbldestWebUsersID.value); if afound then mmInfo.lines.Add('Found: ID: '+tblsrcWebUsersid.AsString+' over correct record') else begin tbldestWebUsers.next; //this command does nothing, i.e. it doesn't move the cursor afound:=(tblsrcWebUsersID.value = tbldestWebUsersID.value); if afound then mmInfo.lines.Add('Found: ID: '+tblsrcWebUsersid.AsString+' was next record') else begin afound:=tbldestWebUsers.locate('ID',tblsrcWebUsersid.value,[]); if afound then mmInfo.lines.Add('Found: ID: '+tblsrcWebUsersid.AsString+' using locate') else mmInfo.lines.Add('Not Found: ID: '+tblsrcWebUsersid.AsString+' using locate'); end; end; end; Just to be clear - it works without the code above (2 x FDTables looking at the same table structure is 2 different SQlite DBS) basically as the execute steps through the source table the destination is always (if both have the same PK's and rows) one record behind after the first row. So I thought I could do the code above to try and do a next rather than a locate in nearly all cases. The .next does nothing though. I have traced the code to and in here it, I am not sure what is going on, but the result is that the cursor doesn't move. Does anyone know why? Who are the Batchmove gurus? D12.1 TIA JAC Share this post Link to post