ACC: Error() Function Does Not Return Detailed Information

Last reviewed: June 6, 1997
Article ID: Q89591
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0

SUMMARY

Moderate: Requires basic macro, coding, and interoperability skills.

When you use the Error(Err) function to trap errors in Access Basic, you will receive a limited error message. To receive an extended error message, use the Error() or Error$() functions. For example, Error(Err) or Error$(Err) might return the message "Table not found" whereas Error() or Error$() would return the message "Table MyTable not found."

MORE INFORMATION

The following is an example of a common format for error handling in Access Basic using MsgBox to display the error text:

   MsgBox "Error #" & Err & ": " & Error(Err)

This line would return an error message like "Error #15: File | Not found" if Err had trapped a "file not found" error.

To receive the extended error message use:

   MsgBox "Error #" & Err & ": " & Error

Note the use of Error and not Error(Err).

Error(Err) returns a generic error message for the given error number whereas Error returns a specific error message.

NOTE: This behavior does not occur in Microsoft Access version 7.0.


Additional query words: pipe
Keywords : kbprg PgmErr
Version : 1.0 1.1 2.0
Platform : WINDOWS
Hardware : x86
Issue type : kbinfo


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 6, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.