ACC2: Trapping Specific ODBC Error MessagesLast reviewed: May 20, 1997Article ID: Q129165 |
The information in this article applies to:
SUMMARYAdvanced: Requires expert coding, interoperability, and multiuser skills. This article demonstrates how to create a sample user-defined Access Basic function you can use to trap and parse a specific Open Database Connectivity (ODBC) error message, such as the error message returned by Microsoft SQL Server if you duplicate a unique index.
MORE INFORMATIONODBC error strings are returned in two parts. The first part is the generic "ODBC call failed" error message; the second part is the specific error message. If you use the Err() function to trap only the error number (which is 3146 for a duplicate unique index), you trap only the first part, the generic "ODBC call failed" error message. To get the specific error message, you must parse the full error string that is returned. This article assumes that you are familiar with Access Basic and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Access Basic, please refer to the "Building Applications" manual.
Creating the Sample FunctionTo create the function that traps the specific error message, create a new module and enter the following procedure. NOTES:
REFERENCESMicrosoft Access "Building Applications," version 2.0, Chapter 10, "Handling Run-Time Errors," pages 221-238 |
Keywords : kbusage OdbcSqlms
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |