Access error message for duplicate index values
Posted on 2007-11-27
I have a field in an access table which is indexed with no duplicates
I want to raise and error message in this aspvb page
at the page top I placed
<%On Error Resume Next %>
at the bottom of the page I placed
<%' to catch the error:
'// Code to execute query
If Err.number <> 0 Then
If InStr(Err.Description, "changes you requested to the table were not successful because they would create duplicate values") >0 Then
Response.Write "<strong>You are trying to insert a duplicate Fund Name into the DataBase. Please select another assignment from the drop down menu.</strong>"
Response.Write "An error occurred. (Here you don't know what error has occured but it is NOT the PK violation error. So show the actual error) " & Err.Description
On Error Goto 0
When a duplicate is added the message does not appear and the record is not inserted.
Can anyone see where I am going wrong please