ACC: Error() Function Does Not Return Detailed Information

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
Issue type : kbinfo


Last Reviewed: March 10, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.