La Web del Programador: Comunidad de Programadores
 
    Pregunta:  9258 - CAPTURAR ERRORES CONECTANDO A BASE DE DATOS
Autor:  Luis Cobo
Como capturar el error que se genera al intentar abrir una conexion a una base de datos y el usuario o la contrasena estan incorrectos.

  Respuesta:  alberto molinero
Échale un vistazo a este código:

Sub MakeUpdateableOracleRecordset_ADO()

Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strConn As String
Dim strSQL As String

On Error Goto Error_Label

Set conn = New ADODB.Connection

With conn
.ConnectionTimeout = 3
'You've got to use a Client Cursor to get an updateable
recordset
.CursorLocation = adUseClient
.Provider = "MSDAORA"
End With

strConn = "Provider=MSDAORA.1;Password=TIGER;User ID=SCOTT;"
strConn = strConn & "Data Source=EMPExample;Locale Identifier=1033"
conn.Open strConn

'Open a recordset, in this case we'll just get one record
strSQL = "Select * from emp where empno = '9996'"
Set rs = New ADODB.Recordset

With rs
'Here's how to make the recordset updateable and navigable
'You can choose adOpenDynamic, OpenForwardOnly or
'adOpenKeyset AND you MUST provide a locking option other
'than adReadOnly
.Open strSQL, conn, adOpenForwardOnly, adLockOptimistic
.Fields("JOB").Value = "manager"
'Now this will work!
.Update
End With

Exit_Sub:
On Error Resume Next
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
Exit Sub

Error_Label:
MsgBox Err.Description
Resume Exit_Sub

End Function

Esto debería solucionar tu pregunta, pero si tienes algún problema dame un toque.

See u!