PDA

View Full Version : Access not catching oracle errors



avgnick
03-23-2007, 10:57 AM
I have an MS Access database that connects to Oracle using an ADO connection. The connection is fine when the user inputs the correct username/password but when they don't Oracle throws up an error and I can't seem to figure out how to handle it in Access. This happens for any error that happens on Oracle but I'll settle for just handling the login error. Has anyone seen something similar and/or know how to code it so that Oracle errors are handled by Access?

stanl
03-23-2007, 12:14 PM
The ADO Connection Object has an Errors Collection. You would want to set up your code to interrogate this Collection then respond appropriately based on the error description or one of the other properties. The following link may be appropriate to your situation:

http://www.devx.com/tips/Tip/13483

Stan

avgnick
03-23-2007, 01:42 PM
thx for the info stan. this seems highly related to my problem but i'm still not sure how to handle/catch it. I have an "on error goto errorHandler" before i open the connection but when it executes it doesn't catch it. is there another way to handle/catch these types of errors?

avgnick
03-24-2007, 04:29 PM
I figured out the problem, or rather my colleague did. The problem was that the VBA editor was set to break on all error rather than being set to break only on unhandled errors. I'm not quite sure why this fixes my problem but it did.

stanl
03-26-2007, 03:44 AM
The problem was that the VBA editor was set to break on all error rather than being set to break only on unhandled errors.

Not really sure what this means myself, but glad your problem is solved. My personal experience with connecting to Oracle through Access involved having a 'user' table to hold name and pw, then track login and disconnect dates/times. This eliminated Oracle errors because the user/pw were validated within Access, then the correct connection string was sent to Oracle.

Probably one of the head OPS will ask you to mark this as solved. Stan

moa
03-26-2007, 05:37 AM
Not really sure what this means myself, but glad your problem is solved.

It's one of VBAs General Options. Quite good for testing/run-throughs after your own error catching is in place.