Determine real cause of ODBC failure (error 3146) with ms-access?

Use the DbEngine.Errors collection.

Sub Update_Temp()
On Error GoTo ErrorTrap
    ' Execute connect code at this point
Exit_errortrap:
    Exit Sub
ErrorTrap:
    Dim myerror As DAO.Error
    For Each myerror In DBEngine.Errors
        With myerror
            If .Number <> 3146 Then
                MsgBox .Description
            End If
        End With
    Next
    Resume Exit_errortrap

End Sub

To enable this code, make sure in VBA settings that error handling is turned on.

Leave a Comment