The information in this article applies to:
SUMMARYThe Visual Basic ODBC layer provides the user with a lot of information on error conditions. The errors can be handled by using the On Error function. MORE INFORMATION
There are 49 trappable errors for Visual Basic ODBC object language
elements (error numbers 600 through 648). A list of these messages and
their meanings can be found in the online help (Data Access Help). In
Visual Basic, all runtime errors are fatal errors; Visual Basic
displays the error message and terminates the program. However, it is
possible to trap these error messages and transfer control to an error
handling routine. The "On Error Go To <linenumber>" function
accomplishes this. Control is transferred to <linenumber> where the
error handling routine begins. Within this routine, the ERR function
can be used to obtain the error number of the current error message,
and based on this, appropriate action can be taken. Some of the Visual
Basic ODBC Object layer (VB/ODBC) error messages use internal
variables to provide specific information about an error. This is
referred to as the "variable portion of the error message" in the
online Data Access Help. The variable portion can be retrieved by
using the ERROR$ function. So, the error handler would typically
contain a call to the ERR function to get the error code; if the error
has a variable portion, it would contain a call to the ERROR$
function.
The important thing to note, especially for programmers transitioning from VBSQL, is that there are no callback error handler controls available. Additional query words:
Keywords : |
Last Reviewed: August 23, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |