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)
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 :
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
And the screenshot of that Add form of vb6 is here: http://tinypic.com/r/w7c7if/6
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.