Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-08

use of the function Locate

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Héctor Fiandor

Dear coleagues:

I have used the function Locate many times, but now I have a question:

I have this part of a program:

        DBEcodNeg.Text:=anadecero(DBEcodNeg.Text,2);
        fdm.tNegocios.Locate('codCliente',DBEcodNeg.Text,[]);
        fdm.ti_medicos2.Edit;
fdm.ti_medicos2.FieldByName('codCliente').AsString:=fdm.tNegocios.FieldByNam
e('codCliente').AsString;

if the operator has a mistake and write in the DBEdit control a number not included previously in the table tNegocios the function Locate drawback the last record of the table.

How can I know if the number asked is in the Table?

Thanks in advance,

Ing. H?ctor Fiandor

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150808/392b43cb/attachment.html>

Reply by email

Héctor Fiandor
to Aradeonas: As I remember locate is a function with boolean value. Check it out. Regards, Ara…

Dear:

I have found some documentation about locate and repaired my program in this way:

           //fdm.tNegocios.Locate('codigo',eCodNeg.Text,[]);
           //fdm.tAnexo_i_m.FieldByName('nomNeg').AsString
:=fdm.tNegocios.FieldByName('nombre').AsString;
           if fdm.tNegocios.Locate('codigo',eCodNeg.Text,[]) then
           begin
             fdm.tAnexo_i_m.FieldByName('nomNeg').AsString
:=fdm.tNegocios.FieldByName('nombre').AsString;
           end
           else           begin           end;

and it work well.

Thanks for your help.

hfiandor

De: Aradeonas [mailto:]
Enviado el: s?bado, 8 de agosto de 2015 09:36 a. m. Para:
Asunto: Re: [Lazarus] use of the function Locate

As I remember locate is a function with boolean value.

Check it out.

Regards,

Ara

http://www.fastmail.com - A no graphics, no pop-ups email service -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150808/50aaae53/attachment.html>

Reply by email