title: How to prevent duplicate records to be entered on database?
body: <p>Here is a part in my code on Visual Basic.
  When I try to input a record which is already present in the database, the program should prompt me that there is a duplicate...</p>
  
  <p>HERE IS MY CODE:</p>
  
  <p>Program adds records</p>
  
  <pre><code>             recSet.Open("SELECT * FROM Prod ", connection, 3, 3)
               recSet.AddNew()
               recSet.Fields("prodSKU").Value = prodSKU.Text
               recSet.Fields("prodName").Value = prodName.Text
               recSet.Fields("prodSRP").Value = prodSRP.Text
               recSet.Fields("prodDesc").Value = prodDesc.Tex 
               recSet.Fields("prodUnit").Value = comboUnit.Text
               recSet.Fields("ClassDisc").Value = classDisc.Text
               recSet.Fields("ProdCateg").Value = comboCtgry.Text
  
                  recSet.Update()
                  recSet.Close()
                  MsgBox("Records added succesful!", MsgBoxStyle.Information, "Success!")
                  'COMOB BOXES'
                  comboUnit.Items.Clear()
                  comboCtgry.Items.Clear()
  
                  recSet.Open("SELECT DISTINCT prodUnit from Prod", connection, 3, 3)
                  Do While Not recSet.EOF
                      comboUnit.Items.Add(recSet.Fields("prodUnit").Value)
                      recSet.MoveNext()
                  Loop
                  recSet.Close()
                  recSet.Open("SELECT DISTINCT prodCateg from Prod", connection, 3, 3)
                  Do While Not recSet.EOF
                      comboCtgry.Items.Add(recSet.Fields("prodCateg").Value)
                      recSet.MoveNext()
                  Loop
                  recSet.Close()
  
                  prodSKU.Text = ""
                  prodName.Text = ""
                  prodSRP.Text = ""
                  prodDesc.Text = ""
                  classDisc.Text = ""
                  comboCtgry.Text = ""
                  comboUnit.Text = ""
  </code></pre>