tcoton wrote:Duplicate records is against the main purpose of a database, you should not have duplicated data in a database, use relationships.
Don't confuse people.
Data in records may be repeated. For example, yesterday two identical shipments of goods were shipped to the same recipient. Two identical actions. Real case? So, in order for the same data to be present in the database, there is a unique primary key column, which guarantees that the records will be different. But the data may be repeated.
In this case, Identity asks how to check the data and, in case of a match, allow/disable recording using a question.
procedure frmCreate_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
frmcreate.edit6.text := replacestr(uppercase(frmcreate.edit1.text + frmcreate.edit2.text + frmcreate.edit3.text + frmcreate.edit4.text + frmcreate.edit5.text),' ','');
if sqlexecute('select count(*) from dedomena where duplicatecheck = "'+frmcreate.edit6.text+'"') > 0 then
begin
if (MessageBox('Dupplicate records. Continue save ?','WARNING !!!',MB_YESNO + MB_ICONWARNING + MB_DEFBUTTON2) = IDNO)
and (frmcreate.edit6.text <> frmcreate.edit7.text) then cancel := true;
end;
end;