ACC: "Application-defined or object-defined error" ErrorID: Q139041
|
Moderate: Requires basic macro, coding, and interoperability skills.
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
Private Sub Form_Error(DataErr As Integer, Response As Integer)
MsgBox Error(DataErr)
Response = acDataErrContinue
End Sub
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.
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
Data integrity rules have been changed. Existing data may not be
valid for the new rules.
This process may take a long time. Do you want the existing data to
be tested with the new rules?
OnError: [Event Procedure]
Private Sub Form_Error(DataErr As Integer, Response As Integer)
MsgBox Error$(DataErr)
MsgBox Application.AccessError(DataErr)
Response = acDataErrDisplay
End Sub
Application-defined or object-defined error.
The text you entered isn't an item in the list.
The text you entered isn't an item in the list.
Application-defined or object-defined error
< a message box with no text appears >
Field 'Orders.EmployeeID' can't contain a null value.
For more information about the AccessError method, search for "AccessError," and then "AccessError method" using the Microsoft Access 97 Help Index.
Keywords : kberrmsg FmsOthr
Version : 7.0 97
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: April 19, 1999