You can also use TDataset.Lookup instead of Locate which doesn't reposition you and can return a result field of the primary key and if that primary key value doesn't match that of the row you're on, you have a duplicate.
Cheers, Paul. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Marshland Engineering Sent: Monday, 6 March 2017 12:29 p.m. To: [email protected] Subject: Re: [DUG] Delphi Digest, Vol 160, Issue 1 >DisableControls >Get bookmark >try > First > while not (duplicateFound or EOF) do > begin > duplicateFound := duplicate check(s) > Next > end > >finally > Restore bookmark > EnableControls >end Thanks the DisableControls is great. There are a lot of cross linked tables and printing forms sometimes took a wile. Using this, it was so fast, I though it had done nothing at all but it did. I used this for the duplicate search. if (dm.tblMaster.Locate('RaceNo',eRaceNo.text,[loCaseInsensitive])) and (sMNZID <> dm.tblMasterMNZID.AsString) then begin The second part is so that it does not find its own instance. Thanks Wallace. _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: [email protected] Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to [email protected] with Subject: unsubscribe _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: [email protected] Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to [email protected] with Subject: unsubscribe
