hi
i having trouble with saving and checking duplicate with my coding..i can't save my data and when i save a new data , it's always say duplicate..i want to save my new data and if it record is already have it, want to show a msgbox saying duplicate..here my coding..please help if u can

Dim strrs As New ADODB.Recordset
Private Sub cmdadd_Click()
On Error Resume Next
        Set strrs = New ADODB.Recordset
        If (txtempid.Text = "" Or txtempid.Text = Null) Or (txtempname.Text = "" Or txtempname.Text = Null) Or (cbodep.Text = "" Or cbodep.Text = Null) Or (cboorg.Text = "" Or cboorg.Text = Null) Or (cborole.Text = "" Or cborole.Text = Null) Then
        MsgBox "Do Not Let The Data Empty,Fill Again", vbInformation, "Please Fill All Data"
        txtempid.SetFocus
        Exit Sub
        Else
        strrs.MoveFirst
        While strrs.EOF = False
        If Val(txtempid.Text) = strrs!Employee_ID Then
            MsgBox "RECORD ALREADY EXISTS!", vbOKOnly + vbInformation, "Duplicate Record"
            txtempid.SetFocus
            Exit Sub
        End If
        strrs.MoveNext
        Wend
        strrs.AddNew
        strrs!Employee_ID = txtempid.Text
        strrs!Employee_Name = txtempname.Text
        strrs!Department_Name = cbodep.Text
        strrs!Organization_Name = cboorg.Text
        strrs!Role_Name = cborole.Text
        txtempid.Text = ""
        txtempname.Text = ""
        cbodep.Text = ""
        cboorg.Text = ""
        cborole.Text = ""
        strrs.Update
        MsgBox "One record have saved & applied in database!", vbOKOnly + vbInformation, "Saving Data"
        End If
End Sub

well, i think i got it now..:D

Private Sub cmdadd_Click()
On Error Resume Next
        Set strconn = New ADODB.Connection
        Set strrs = New ADODB.Recordset
        strconn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "\EmployeeList.mdb"
        strsql = "Select * From EmpTable"
        strrs.Open strsql, strconn, adOpenDynamic, adLockOptimistic
        If (txtempid.Text = "" Or txtempid.Text = Null) Or (txtempname.Text = "" Or txtempname.Text = Null) Or (cbodep.Text = "" Or cbodep.Text = Null) Or (cboorg.Text = "" Or cboorg.Text = Null) Or (cborole.Text = "" Or cborole.Text = Null) Then
        MsgBox "Do Not Let The Data Empty,Fill Again", vbInformation, "Please Fill All Data"
        txtempid.SetFocus
        Exit Sub
        Else
        strrs.MoveFirst
        If strrs.Fields(0) = txtempid.Text Then
        While strrs.EOF = False Or strrs.BOF = False
            MsgBox "RECORD ALREADY EXISTS!", vbOKOnly + vbInformation, "Duplicate Record"
            txtempid.SetFocus
            Exit Sub
        strrs.MoveNext
        Wend
        End If
        strrs.AddNew
        strrs(0) = txtempid.Text
        strrs(1) = txtempname.Text
        strrs(3) = cbodep.Text
        strrs(5) = cboorg.Text
        strrs(7) = cborole.Text
        txtempid.Text = ""
        txtempname.Text = ""
        cbodep.Text = ""
        cboorg.Text = ""
        cborole.Text = ""
        strrs.Update
        MsgBox "One record have saved & applied in database!", vbOKOnly + vbInformation, "Saving Data"
        strrs.Close
        strconn.Close
        End If
This question has already been answered. Start a new discussion instead.