Subject using Tib_Query.Locate in inserting mode
Author rudi_josic
Hi all.-

first excuse my poor engish...

I want to verify if an field exist during an inserting a new one to
prevent duplicates.

The field is Primary key and is VarChar (25) and not null off course.

I need to verify it onExit the edit control (teacher requirement) and
i try to do the next:

procedure TFormaClientes.EditCedulaExit(Sender: TObject);
begin
with TIB_Query(TIB_Edit(sender).DataSource.Dataset) do
if State = dssInsert then
try
if Locate('"Cedula"',TIB_Edit(sender).Text,[]) then
begin
ShowMessage(Format(csExiste,['La C├ędula','a','a']));
TIB_Edit(sender).SetFocus;
TIB_Edit(sender).SelectAll;
end
except
Abort;
end;
end;

but the locate fuction always returns true.

What i'm doing wrong??

or any sugestion will be appreciated

Thanks in advance.-

Rudi Josic.