ACC: "Application-Defined or Object-Defined Error" Error Message (139041)
The information in this article applies to:
- Microsoft Access for Windows 95 7.0
- Microsoft Access 97
This article was previously published under Q139041
Moderate: Requires basic macro, coding, and interoperability skills.
SYMPTOMS
If you use the Error() or Error$() functions to get the textual description
of an error message, you may receive the following error message:
Application-defined or object-defined error
You may receive this error message when you try to get the description of
an error trapped in a form's Error event as follows:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
MsgBox Error(DataErr)
Response = acDataErrContinue
End Sub
CAUSE
The error message being trapped is Microsoft Access specific. When you pass
an error number to the Error() function that is not a Visual Basic for
Applications specific error, Visual Basic for Applications does not call
back into the hosting application to ask it for the error message.
RESOLUTION
Microsoft Access 7.0 introduced the new AccessError method that you can use
to return the descriptive string associated with a Microsoft Access error
as follows:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
MsgBox Application.AccessError(DataErr)
Response = acDataErrContinue
End Sub
NOTE: The AccessError method will return a string associated only with
Microsoft Access errors and Visual Basic errors. It will NOT return
descriptive strings associated with data access errors.
REFERENCES
For more information about the AccessError method, search for
"AccessError," and then "AccessError method" using the Microsoft
Access 97 Help Index.
Modification Type: | Major | Last Reviewed: | 10/20/2003 |
---|
Keywords: | kberrmsg kbprb KB139041 |
---|
|