hi,
I am using Vb.net and Access database.
I want a code to avoid duplicate records.
In Access Database I have a table named as TblBrand. It has BrandID as Primary key & BrandName as column for recording brand name.
I made some entries in BrandName column in Access Database.
While saving new record with form in vb.net, that brand should not be in access database to avoid duplicate entry, if there is same brand it should give message as "Brand already exists." and if it is new, it should be saved.
I have this code for save button for saving record -
thanks
I am using Vb.net and Access database.
I want a code to avoid duplicate records.
In Access Database I have a table named as TblBrand. It has BrandID as Primary key & BrandName as column for recording brand name.
I made some entries in BrandName column in Access Database.
While saving new record with form in vb.net, that brand should not be in access database to avoid duplicate entry, if there is same brand it should give message as "Brand already exists." and if it is new, it should be saved.
I have this code for save button for saving record -
VB.NET:
If TxtBrandName.Text = "" Then TxtBrandName.Focus() : Exit Sub
On Error GoTo SaveErr
TblBrandBindingSource.EndEdit()
TblBrandTableAdapter.Update(ModernUIDataSet1.TblBrand)
MessageBox.Show("Brand Saved.")
TxtBrandName.Focus()
SaveErr:
Exit Sub
thanks
Last edited by a moderator: