Re: How do I capture content of an ODBC error message from Oracle?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: John Smith (johnDOTsmithATbromleyhospitalsDOTnhsDOTuk)
Date: 11/10/04


Date: Wed, 10 Nov 2004 16:08:14 -0000

These errors are in the errors collection and there may be more than one of
them. For similar reasons I have just written the following function to
retrieve them:

Public Function GetDAOErrors() As String
  Dim errX As Error, Message As String
  On Error Resume Next
  Message = ""
  If Errors.Count > 0 Then
    For Each errX In DBEngine.Errors
      Message = Message & errX.Description & vbCrLf
    Next errX
  End If
  GetDAOErrors = Message
End Function

I call this from the event error trap, with a little modification I think that
it will do what you want.

-- 
HTH
John
"sjlevine34" <sjlevine34@discussions.microsoft.com> wrote in message
news:82A1A5D3-D4F4-48E8-9B9D-52F618879160@microsoft.com...
> I am using Microsoft Access as a front end for an Oracle database.  All of
> the data validation is done in the Oracle Tables through the use of triggers.
>  The error messages are ones I coded for as user-defined exceptions with
> concise user-friendly descriptions.   They display in their entirety in the
> forms I use to maintain the tables.  For example, the following error message
> may be displayed:
>    ODBC--insert on a linked table 'OBI_DONOR_EMAIL' failed.
>   [Oracle][ODBC][Ora]ORA-20700: Email address cannot be blank.
>   ORA-06512: at "OBIEBIS.OBI_DONOR_EMAIL_T2", line 23
>   ORA-04088: error during execution of trigger 'OBIEBIS.OBI_DONOR_EMAIL_T2'
>    (#20700)
> I would like to, through the use of the form on error event and the mid()
> function, display the error message as "Email address cannot be blank.".
> Despite extensive searching, I have not been able to find the object holding
> the message "[Oracle][ODBC][Ora]ORA-20700: Email address cannot be blank.
> <LF><LF> ORA-06512: at "OBIEBIS.OBI_DONOR_EMAIL_T2", line 23 <LF> ORA-04088:
> error during execution of trigger 'OBIEBIS.OBI_DONOR_EMAIL_T2' (#20700)".  I
> know it has to be there because the message box displays the error after
> completion of the form on error event procedure.
> Does anyone know where this error message resides in access and how I can
> get at it during the form error event procedure?


Relevant Pages

  • Re: Where to put my Error handling Code
    ... focus needs to be returned to that control so that the user can change it. ... Right now, after clicking OK to my error message, the standard message also ... Error event to display the Error number generated when the user violates your ... MsgBox "Please enter the 5 digit CAP Number" ...
    (microsoft.public.access.formscoding)
  • Re: Where to put my Error handling Code
    ... "Pamela" wrote: ... My error message popped up but then I think ... focus needs to be returned to that control so that the user can change it. ... Error event to display the Error number generated when the user violates your ...
    (microsoft.public.access.formscoding)
  • Re: Where to put my Error handling Code
    ... Private Sub Form_Error ... My error message popped up but then I think ... focus needs to be returned to that control so that the user can change it. ... Error event to display the Error number generated when the user violates your ...
    (microsoft.public.access.formscoding)
  • Re: Where to put my Error handling Code
    ... "theDBguy" wrote: ... My error message popped up but then I think ... focus needs to be returned to that control so that the user can change it. ... Error event to display the Error number generated when the user violates your ...
    (microsoft.public.access.formscoding)
  • Re: Where to put my Error handling Code
    ... Error event to display the Error number generated when the user violates your ... an input mask on this control requiring the 5 numbers but if the user doesn't ... enter it correctly the system gives a very non-user-friendly error message. ... MsgBox "Please enter the 5 digit CAP Number" ...
    (microsoft.public.access.formscoding)