Quote:
> I use Visual Basic 5 on Windows 95.
> I'm connected to Access 97 databases with tables bound to Oracle 7 via
> oracle ODBC drivers; 2.05.03.01.
> When Sql error occurs, I always have the message ='Err 3146 ODBC Call
> failed'
> but I have not the real error message of oracle server.
> I tried with Microsoft ODBC drivers with the same result.
> Please help me to retrieve the oracle error message.
> Thanks in advance
Frederic,
In VB5 the errors are stored in the Errors colection. I wrote a bit of
code which just loops through to get the errors (see attached)
Function fsCheckError() As String
' Trap the "ODBC - Call Failed" message and get the
' expected error.
Dim msErrStr As String
Dim miErrCt As Integer
Dim mbNotOurErr As Boolean
On Error GoTo ErrTrap
msErrStr = ""
mbNotOurErr = True
If Errors.Count > 1 Then
miErrCt = Errors.Count - 1
While mbNotOurErr
If InStr(1, Errors(miErrCt), "ODBC--Call Failed") = 0 Then
'This is a "bogus" error message raised because we raise
exceptions
'in our packages to pass information to the front end
miErrCt = miErrCt - 1
Else
'This is the correct message
mbNotOurErr = False
End If
If miErrCt = 0 Then
'Get out clause
mbNotOurErr = False
End If
Wend
'Last error is current error
msErrStr = Errors(miErrCt)
Else
msErrStr = Errors(0)
End If
ErrTrap:
fsCheckError = msErrStr
End Function
Hope this helps.
Duane