Re: Access 2007 ODBC Error Trapping
- From: "AG" <NOSPAMagiamb@xxxxxxxxxxxxxxxx>
- Date: Fri, 6 Mar 2009 08:30:24 -0500
Mark,
Thanks for replying, but obviously, you did not read and understand my
problem.
All you posted was a canned reply.
I specified that I am working with ODBC and the dbengine errors collection,
which is reporting the wrong error.
Plus, you code is completely wrong.
In the Form_Error event, the error number is contained in the DataErr
argument, NOT the access error object.
In the Form_Error event, Err.Number is 0 and Err.Description is empty.
As I already specified, the error is 3146, ODBC call failed.
At that point, I should be able to get the real error from the dbengine
errors collection, but that is reporting the incorrect error.
No, your response is not at all helpful.
Sample code?
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Dim strErr As String
Dim intErr As Integer
strErr = "Access error " & CStr(DataErr) & " " & AccessError(DataErr)
If DBEngine.Errors.Count > 0 Then
strErr = strErr & vbCrLf & "DbEngineErrors:"
For intErr = 0 To DBEngine.Errors.Count - 1
strErr = strErr & vbCrLf & DBEngine.Errors(intErr).Number & " / " &
DBEngine.Errors(intErr).Description & " / " & DBEngine.Errors(intErr).Source
Next
End If
MsgBox strErr, vbCritical, "Not What Is Desired"
End Sub
This result is:
Access error 3146 ODBC--call failed.
DbEngineErrors:
3021 / No current record. / DAO.Recordset
I would expect something like:
Access error 3146 ODBC--call failed.
DbEngineErrors:
515 / ...column does not allow null... / DAO.Recordset
Or, am I looking in the wrong place to get the actual error?
Can anyone offer a solution?
--
AG
Email: npATadhdataDOTcom
"Mark Han[MSFT]" <v-fathan@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:$6nBUwknJHA.1700@xxxxxxxxxxxxxxxxxxxxxxxxx
Hi AG,
Thank you for using Microsoft MSDN Managed Newsgroup. My name is Mark Han.
I am glad to work with you on this issue.
From your description, I understand that you would like to trap the error
in the form error event. However the error captured is always 3021. not
the
actual error code. If I have misunderstood, please let me know.
in order to address your concern, I make an example here.
Visual Basic Error event arises when a run-time error occurs in Access on
the current form.
Error Event Visual Basic Example:
It is good practice to have an On Error event handler in each form. In
this example we simply trap the error and display a message to the userr.
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Msgbox "An unexpected error has occurred in the form. " & _
"The error description is " & err.description
Response = acDataErrContinue
End Sub
The response argument can have either of two values:
acDataErrContinue: Ignore the error and continue without displaying the
Microsoft Access error message.
acDataErrDisplay: Display the Microsoft Access error message. This is the
default setting.
Hope the above helpful.
Besides, in order to better assist you with the issue, if it is convenient
to you, please post the error event code here.
I look forward to hearing from you.
Best regards,
Mark Han
Microsoft Online Community Support
===========================================================
Delighting our customers is our #1 priority. We welcome your
comments and suggestions about how we can improve the
support we provide to you. Please feel free to let my manager
know what you think of the level of service provided. You can
send feedback directly to my manager at: msdnmg@xxxxxxxxxxxxxx
===========================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or
a Microsoft Support Engineer within 2 business day is acceptable. Please
note that each follow up response may take approximately
2 business days as the support professional working with you may need
further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are
best handled working with a dedicated Microsoft Support Engineer by
contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
============================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
=========================================================
.
- Follow-Ups:
- Re: Access 2007 ODBC Error Trapping
- From: Mark Han[MSFT]
- Re: Access 2007 ODBC Error Trapping
- References:
- Access 2007 ODBC Error Trapping
- From: AG
- RE: Access 2007 ODBC Error Trapping
- From: Mark Han[MSFT]
- Access 2007 ODBC Error Trapping
- Prev by Date: Re: Form Becoming Corrupted
- Next by Date: Have you tried the accurals newsgroup
- Previous by thread: RE: Access 2007 ODBC Error Trapping
- Next by thread: Re: Access 2007 ODBC Error Trapping
- Index(es):
Relevant Pages
|