title: How to avoid duplicate entries in access from vb6?
body: <p>I am using Vb6 and Access 2007. I am adding records to the access table name "subjectcode" from vb6. The details of subjectcode table are below.</p>
  
  <p>Subjectcode table :         Heading(Degree,Branch,Year1,Year2,Semester,Subjectcode,Subjectname,Theory_Practical, Major_Allied_Elective) values (Bsc,computerscience,2001,2004,1,RACS1,Vb6 programming,Theory,Major)</p>
  
  <p>Note :The primary key in the above table is Degree,Branch,Year1,Year2,Semester,Subjectcode
  And the code i used to add entry to the access table from vb6 are given below :</p>
  
  <pre><code>    If degree = "" Or branch1 = "" Or year1 = "" Or year2 = "" Or semester = "" Or subcode.Text = "" Or subname.Text = "" Or theory.Text = "" Or major.Text = "" Then
      MsgBox "Fields can't be empty ! All are mandatory!"
      Else
      rs.Open "select * from subjectcode", con, 1, 3
      rs.AddNew
      rs!degree = degree
      rs!branch = branch1
      rs!year1 = year1
      rs!year2 = year2
      rs!semester = semester
      rs!Subjectcode = subcode.Text
      rs!Subjectname = subname.Text
      rs!Theory_Practical = theory.Text
      rs!Major_Allied_Elective = major.Text
      rs.Update
      MsgBox "Successfully Saved !", vbOKOnly + vbInformation, "info"
      rs.Close
      End If
  </code></pre>
  
  <p>And the screenshot of that Add form of vb6 is here: <a href="http://tinypic.com/r/w7c7if/6" rel="nofollow">http://tinypic.com/r/w7c7if/6</a>
  The record is added when the same entry is not exist. And if the record is already exist it should say "Record Already exists" and i don't know how to do that. Could you guys give me idea please.</p>