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
: 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
: : 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]
: : : 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