Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

check duplicate record

ganesh4uganesh4u Posts: 68Member
hi,
I am developing a database program.i am using adodb.Suppose user entered records in table with one primary keyfield.Next time when user add new record by Clicking add button recordset.addnew procedure will be executed which appends blank record .user will enter keyfield in textbox and press enter.when he press enter in code some procedure should execute which find whether this keyfield is already there or not.If by mistake user is making duplicate entry, message should pop up as "Record already exists" and cancel addnew procedure and show contents of that record.if it's not duplicate entry then it should follow normal procedure.
I have little idea how to do it but please guide me in details .please help me urgently.
Ganesh :)

Comments

  • PrzemekG_PrzemekG_ Posts: 595Member
    : hi,
    : I am developing a database program.i am using adodb.Suppose user entered records in table with one primary keyfield.Next time when user add new record by Clicking add button recordset.addnew procedure will be executed which appends blank record .user will enter keyfield in textbox and press enter.when he press enter in code some procedure should execute which find whether this keyfield is already there or not.If by mistake user is making duplicate entry, message should pop up as "Record already exists" and cancel addnew procedure and show contents of that record.if it's not duplicate entry then it should follow normal procedure.
    : I have little idea how to do it but please guide me in details .please help me urgently.
    : Ganesh :)
    :
    When you try to add a new record with duplicated primary key or a unique field, an error will be raised, so you will know the record already exists
  • GideonOmegaGideonOmega Posts: 617Member
    : : hi,
    : : I am developing a database program.i am using adodb.Suppose user entered records in table with one primary keyfield.Next time when user add new record by Clicking add button recordset.addnew procedure will be executed which appends blank record .user will enter keyfield in textbox and press enter.when he press enter in code some procedure should execute which find whether this keyfield is already there or not.If by mistake user is making duplicate entry, message should pop up as "Record already exists" and cancel addnew procedure and show contents of that record.if it's not duplicate entry then it should follow normal procedure.
    : : I have little idea how to do it but please guide me in details .please help me urgently.
    : : Ganesh :)
    : :
    : When you try to add a new record with duplicated primary key or a unique field, an error will be raised, so you will know the record already exists
    :

    if you want to check against Non - primary key data - before you add the data into the table open a recordset and search in the field for that value you want to check - then you can branch your logic to add the data - or display a message to the user.
    [blue]
    C:Dos
    C:Dos Run
    Run Dos Run
    [/blue]

  • Termc1224Termc1224 Posts: 84Member
    : : : hi,
    : : : I am developing a database program.i am using adodb.Suppose user entered records in table with one primary keyfield.Next time when user add new record by Clicking add button recordset.addnew procedure will be executed which appends blank record .user will enter keyfield in textbox and press enter.when he press enter in code some procedure should execute which find whether this keyfield is already there or not.If by mistake user is making duplicate entry, message should pop up as "Record already exists" and cancel addnew procedure and show contents of that record.if it's not duplicate entry then it should follow normal procedure.
    : : : I have little idea how to do it but please guide me in details .please help me urgently.
    : : : Ganesh :)
    : : :
    : : When you try to add a new record with duplicated primary key or a unique field, an error will be raised, so you will know the record already exists
    : :
    :
    : if you want to check against Non - primary key data - before you add the data into the table open a recordset and search in the field for that value you want to check - then you can branch your logic to add the data - or display a message to the user.
    : [blue]
    : C:Dos
    : C:Dos Run
    : Run Dos Run
    : [/blue]
    :
    : On your Save button event
    on error goto errmessage
    rs.update
    exit sub
    errmessage:
    if err.number = -2147217873 then
    msgbox("Id already exist.")
    else
    msgbox(err.number & ": " & err.description)
    end if



Sign In or Register to comment.