JoanneJames
Registered User.
- Local time
 - Today, 08:29
 
- Joined
 - Feb 19, 2008
 
- Messages
 - 59
 
I have Access 2003 linked to SQL Server 2005, - used to have Access backend and now must move to SQL Server . I  am  testing what happens if errors occur - When testing by deliberately creating a duplicate record in my form, this error  came up ODBC Call Failed (# 3146)-  and, it also includes a couple of anticipated SQL Server errors  as well (ie Violation of Primary Key Constraint.. Cannot insert Duplicate Key in Object...).   Q. is: how do I capture a duplicate error so I can create a generic duplicate msg for the user?  Is it normal to have the  3146 error tagging along?
 
I have gotten this same error along with other DIFFERENT SQL errors, so the code that handles this error ( # 3146) cannot do anything other than show the message.
 
My thinking was that this error (#3146) was the first error, with the SQL errors included, the 2nd, 3rd. If this is true, then I would need to find the cause of the first error. Is this thinking correct? If NOT, how do I go about capturing the exact error for dups from SQL Server? If SO, I tried doing an Access trace & the closest thing I could find that seemed to be related to the ODBC call failed was an EXIT SQLErrorW stmt in the trace with return code 100 (SQL_NO_DATA_FOUND). The other 2 trace stmts for the other 2 SQL errors returned code 0 (SQL_Success). I am scratching my head here...
 I have gotten this same error along with other DIFFERENT SQL errors, so the code that handles this error ( # 3146) cannot do anything other than show the message.
My thinking was that this error (#3146) was the first error, with the SQL errors included, the 2nd, 3rd. If this is true, then I would need to find the cause of the first error. Is this thinking correct? If NOT, how do I go about capturing the exact error for dups from SQL Server? If SO, I tried doing an Access trace & the closest thing I could find that seemed to be related to the ODBC call failed was an EXIT SQLErrorW stmt in the trace with return code 100 (SQL_NO_DATA_FOUND). The other 2 trace stmts for the other 2 SQL errors returned code 0 (SQL_Success). I am scratching my head here...