Microsoft KB Archive/124395

= ACC: Cannot Trap ODBC Errors with Form OnError Property Code =

Article ID: 124395

Article Last Modified on 11/17/2000

-

APPLIES TO


 * Microsoft Access 2.0 Standard Edition
 * Microsoft Access 95 Standard Edition

-



This article was previously published under Q124395



Advanced: Requires expert coding, interoperability, and multiuser skills.



SYMPTOMS
Even though you have specified event procedure code to trap errors in your form's OnError property, you still receive ODBC error messages.



CAUSE
ODBC error messages normally occur in two parts. The first part is

ODBC call failed

followed by a second part such as:

[Microsoft][ODBC SQL Server Driver][SQL Server] 

The first part of the error message can be trapped by the code specified in the OnError property, but the second part cannot. The second part of the error message appears on the screen after the event procedure code finishes running.



RESOLUTION
If the ODBC error is triggered by a procedure that contains a routine to handle errors (rather than by a form), the procedure will be able to trap both parts of the error message.



STATUS
Microsoft has confirmed this to be a problem in Microsoft Access 2.0 and 7.0. This behavior has been changed in Microsoft Access 97.

NOTE: Although this behavior has changed in Microsoft Access 97, you can still not trap the second part of the error. An event does fire when there is an error; however, there is no retrievable information about the error message. The event that fires only helps you to hide existing errors from a user.

Keywords: kberrmsg kbbug kbusage KB124395

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.