Page 1 of 1

How to goto nearest?

Posted: Sat 28 Apr 2012 11:15
by charin
I would like to search for nearest but following command it not working.
Anyone have solution for this?

with MyTable1 do begin
SetKey;
FieldByName('Company').AsString:=edSearch.text;
GotoNearest;
end;

Re: How to goto nearest?

Posted: Sat 28 Apr 2012 13:39
by AlexP
hello,

There is no GoToNearest method in MyDAC. Instead of it, you should use the Locate or LocateEx method.

Code: Select all

MyTable1.Locate('Company',edSearch.text,[]);

Re: How to goto nearest?

Posted: Sat 28 Apr 2012 18:27
by cybsistemas
include memdata.dcu in the uses
MyTable1.LocateEx('Company',edSearch.text,[lxNearest])

Re: How to goto nearest?

Posted: Sun 29 Apr 2012 04:16
by charin
Thanks, cybsistemas & AlexP it work very well.

Re: How to goto nearest?

Posted: Mon 30 Apr 2012 08:35
by AlexP
hello,

If you have any other questions, feel free to contact us.