Capturing returned ODBC error message using form_Error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have written an application with an Access front end to an Oracle Database.
All security and data validation is in the Oracle database, including
user-defined error messages. These error messages are returned as ODBC--
linked failed and, when occurring in a VBA module, the specific
Oracle-generated message may be retrieved from
dbEngine.errors(0).description. However when I try to access the error
message in dbEngine errors while in the forms.Errors event, it is not there.
I would very much like to capture it so that I can extract the meaningful
portion using mid, left and right and display it as a user-friendly message.

I know it is preserved somewhere in Access because, unless you make response
= acDataErrContinue, it displays in Access's own error message box after
form_error completes. Is there any way I can retrieve this message during
the forms_Errors event?

sjl
 
I am already capturing the Oracle errors in the manner described elsewhere in
the application where I am doing explicit VBA DAO reads and writes and was
originally going to use this approach for where the screens directly interact
with the tables. But this does not work within the form_errors event.

I started to use the VBA code approach for the screens. However it became
quickly apparent that this approach would be very cumbersome and mess up the
program flow. Thus I am really left with doing this during the form_errors
routine.

Advice given me regarding this issue on another list suggested that I try to
capture the SQLerror property of the ODBC link itself and this is the
approach I am now taking.

sjl
 
Now we have run into the problem that the Oracle ODBC driver dll cannot be
referenced by an Access VBA routine. If we were to write a visual C++
routine to interface to the ODBC driver, could this routine be used by Visual
Basic? Is there something out there already that can do this?

sjl
--
 
Back
Top