Can anyone help me with an 'IF' statement that will prevent saving a duplicate record in MSSQL

this depends on how you have designed your database. you should have an ID field which is the number of record and this to be an PK.
in this way all fields are identified with an unique ID.

second step:
create an trigger to verify if the element exist in database already. if select is returning null then then your current record is unique

best regards,

What I meant is is there code I can use in Delphi to check and prevent this\
ie if "'+Combobox1.Text+'" exists
then
Button1,Enabled= False
or something like that, and yes there a Unique ID column

Thanks

a solution would be to create a query, and to send the new field to it as a parameter. in query you must make a simple select statement. if query isn't returning nothing then your field is unique.

best regards,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.