Re: Help: 2.0 : How can I capture Oracle errors in MS Access 2.0

From: Michael Carmack <mcarmack_at_freenet.columbus.oh.us>
Date: 1997/05/12
Message-ID: <5l72e1$eon_at_login.freenet.columbus.oh.us>#1/1


All you can do is write error handlers in your Access Basic code that scan the Err.Description for the Oracle error codes you may expect to occur in that code, e.g. scan for the string "ORA-01031" in places where a user may try to do something he has no privilege for. Then you can display a custom dialog box to handle the message more elegantly. I agree that the ODBC error messages are pretty bad, so I usually include a default error handler for anything else that says "A database error has occurred, please report the following error message to your supervisor" and then the Err.Description, which is the Oracle error minus the extra ODBC garbage.

SRINIVASA MEDAM (medams_at_ucunix.san.uc.edu) wrote:

: Hi,
 

: I am using Oracle as attached tables in Access. Oracle database has
: triggers, primary keys, roles, etc related to the tables for different
: users. How would I capture oracle error message and display it in a
: better way. For example, EMPLOYEE table has EMPLOYEE_ID (number) column
: as primary key. If someone tries insert a duplicate in EMPLYEE_ID column
: Oracle returns an error, saying unique constraint constraint EMPLOYEE_PK.
 

: My intention is, how can I capture this oracle error in an access form and
: display it to the user something like "The EMPLOYEE_ID you entered
: <entered_id> already exists, please choose a different EMPLOYEE_ID".
: I am sure some of you might have dealt with this problem. I really
: appreciate if someone can help me with an idea or direction.
 

: Another example if USER_A has only select privilege on EMPLOYEE. If USER_A
: tries to edit a form based on EMPLOYEE table, Access shows a message that
: "ODBC Insert failed on Attached table 'EMPLOYEE' " and then
: "[Oracle][Oracle ODBC Driver][Oracle OCI]ORA-01031: Insufficient
: Privileges.". In stead of these messages is there a way that I can
: show a message box to the user like "Your userid <user_id> does not have
: sufficient privilege to edit the table EMPLOYEE. Contact your system
: administrator for adding new records privilege the EMPLOYEE table".

: Thanks in advance
: Srini Medam.
 

-- 
========================================================================
"Villains, I say to you now:       |   Mike Carmack
 KNOCK OFF ALL THAT EVIL!"         |   Vulcan Dragon -==(UDIC)==-
    S P O O N !!!!    - The Tick   |   mcarmack_at_freenet.columbus.oh.us
Received on Mon May 12 1997 - 00:00:00 CEST

Original text of this message