Iam beginner in Vb & SQL.
I am entering data like MemberName(txtMemberName.text) in sql database through VB6 front end form. I can enter same data in this field.
Can any body help me in avoiding the duplicacy of the data. Following is my code on Save button :-
Private Sub btnSave_Click()
If (validate()) Then
Adodc1.Recordset.Fields("MembershipID") = Val(Trim(txtMemberID.Text))
Adodc1.Recordset.Fields("MemberName") = Trim(txtMemberName.Text)
Adodc1.Recordset.Fields("Address") = txtAddress.Text
Adodc1.Recordset.Fields("ContactNo") = Val(txtContactNo.Text)
Adodc1.Recordset.Fields("Height") = Val(txtHeight.Text)
Adodc1.Recordset.Fields("Gender") = cmbGender.Text
Adodc1.Recordset.Fields("JoiningDate") = CDate(Trim(txtJoiningDate.Text))
Adodc1.Recordset.Fields("DateOfBirth") = CDate(Trim(txtDateOfBirth.Text))
If Option1.Value = True Then
Adodc1.Recordset.Fields("IsTrainerRequired") = 1
Else
Adodc1.Recordset.Fields("IsTrainerRequired") = 0
End If
Adodc1.Recordset.Update
MsgBox "Member Successfully Added", vbOKOnly, "Member Registration"
Adodc1.Recordset.MoveLast
btnAdd.Enabled = True
btnSave.Enabled = False
btnClear.Enabled = False
Else
MsgBox "Please Enter and Save Appropriate Values", vbApplicationModal
End If
'ClearAll
End Sub
Software/Hardware used:
ASKED:
March 11, 2012 3:00 PM
UPDATED:
April 11, 2012 2:09 PM
Take a look at This similar question.
Feel free to post any additional question/doubts you may encounter.