Click to See Complete Forum and Search --> : About VBA Catching DAO Errors


Victoria
April 2nd, 2001, 01:17 AM
I have programmed with excel97's VBA to access oracle, when i commit the transaction, met some problems. In fact, in Sqlplus, when commit the update sql, the oracle error occurrs. But I cannot catch this error in Excel Macro.
Then code is:
private sub updateTab()
Dim dbConnect as Database
din str as String
Set dbConnect = OpenDatabase("db", dbDriverNoPrompt, False, Connect:="ODBC;DSN=;UID=user;PWD=password;")
On error Goto error_handle
DBEngine.BeginTrans
str="update emp set name='user1' where id=1"
Call dbConnect.Execute(str, dbSQLPassThrough)
DBEngine.CommitTrans
Exit Sub
error_handle:
msgbox DBEngine.Error(0).Description
End Sub

When i debug the Errors.count, it appears 0.