Can someone help me on my database with regards that the records can be prone to data redundancy..
pls help to avoid record redundancy on my database....
How do I check if the record that i will be input is existing on my database.. and i want to prompt the user if the record is exist and adding this data will be cancel.

here is my code for save button,pls have an example with codes so that i could clearly understand ...thanks!! :D

rs = New ADODB.Recordset
    With rs
        'check if important item is null '
        If txtappln.Text = "" Or txtappfn.Text = "" Or txtappmn.Text = "" Or txtclass.Text = "" Or txtcnum.Text = "" Or txtaddr.Text = "" Or txtbrgy.Text = "" Then
            MsgBox("Some object in the Applicant Personal Information or Classification or Ctrl Number is not filled up", MessageBoxIcon.Warning)
            .Cancel()
        Else
            'Save'
            .Open("Select * from Applicant", con, 2, 3)
            .AddNew()
            .Fields("LAST_NAME").Value = txtappln.Text
            .Fields("FIRST_NAME").Value = txtappfn.Text
            .Fields("MIDDLE_NAME").Value = txtappmn.Text
            .Fields("ADDRESS").Value = txtaddr.Text
            .Fields("CLASSIFICATION").Value = txtclass.Text
            .Fields("CONTROL_NO").Value = txtcnum.Text
            .Fields("BARANGAY").Value = txtbrgy.Text
            MsgBox("Record has been save !!", vbInformation)
            .Update()
            .Close()
        End If
    End With`

Edited 2 Years Ago by diafol: wrong forum

You could do

Dim qry As String = "SELECT COUNT(*) AS numrec FROM Applicant" &
                    " WHERE LAST_NAME  = '" & txtappln.Text & "'" &
                    "   AND FIRST_NAME = '" & txtappfn.Text & "'" &
                    .
                    .
                    .
rs.Open(qry, con, 2, 3)

If rs("numrec").Value = 0 Then
    'the record does not exist
Else
    'the record exists
End If

This assumes you are using ADODB. To see how to do this using OleDb with parameters (which you should be doing) please see here.

Can you post the code that you are running? It would also help if you could post the value of qry after

Debug.WriteLine(qry)
This question has already been answered. Start a new discussion instead.