Locate for Key Violation
Interbase , Delphi5 pro.,Win98
what is wrong with below codes ?
I have dataentry form which have few editboxes.
there is below code one of the editbox's on exit event to check key
violation.
cname:=edit1.text;
if dm.IbQuery1.locate('CustName',cname,[]) then
begin
showmessage(' ..........'); // key violation
edit1.setfocus;
abort;
end;
it works well first time , but when i try to change the edit1.text (to
prevent key viol.) and exit from edit1.text 2.time my screen freezes.
for example, edit1.text:= 'John Doe' but my table has another John Doe
to prevent the key violation i add a .(dot) at the end of the edit1.text
John Doe.) after that when i exit from edit1.text my screen freeze.
2- my sql is SELECT * FROM CUSTOMER ORDER BY CUSTNAME
(CustName has Unique Index on the table ) in this situation
which one is faster to locate a record ( on Query or on Table ? )
ibquery1.locate.... or Ibtable1.locate.... ?
Thank You.