Rusty
Registered User.
- Local time
- Today, 22:58
- Joined
- Apr 15, 2004
- Messages
- 207
Hey guys,
Does anyone know the code to get rid of the standard Access error message on attempted duplicate entries on a form?
The field name is "txtPersonProjectID" the control source is "PersonProjectID" from the table "tblPersonProject". The field is indexed as "Yes (No Duplicates)" so when a duplicate value is entered the user gets the standard msg of :
“The changes you requested to the table were not successful because they would create duplicate values…”
I want to display something more useful like "This person is already working on this project"
The form is called "frmPersonProject" and I've tried placing the following code on the Before Update event of the field "txtPersonProjectID", but clearly it does not work, any ideas??
Rusty
Does anyone know the code to get rid of the standard Access error message on attempted duplicate entries on a form?
The field name is "txtPersonProjectID" the control source is "PersonProjectID" from the table "tblPersonProject". The field is indexed as "Yes (No Duplicates)" so when a duplicate value is entered the user gets the standard msg of :
“The changes you requested to the table were not successful because they would create duplicate values…”
I want to display something more useful like "This person is already working on this project"
The form is called "frmPersonProject" and I've tried placing the following code on the Before Update event of the field "txtPersonProjectID", but clearly it does not work, any ideas??
Rusty

Code:
Private Sub txtPersonProjectID_BeforeUpdate(Cancel As Integer)
If txtPersonProjectID <> txtPersonProjectID Then
Cancel = True
Msgbox “Person exists in project etc..”
End If
End Sub
Last edited: