Article ID: 195487
Article Last Modified on 3/14/2005
Set Connection.CursorLocation = adUseClientThis way the client engine passes the IConnectionPointContainer property, and ADO can hook in the notification.
Option Explicit
Dim WithEvents rs_Events As ADODB.Recordset
Private Sub cmdOpenSchema_Click()
Dim cn As New ADODB.Connection
On Error GoTo ErrHandler
Set cn = New ADODB.Connection
' Uncomment the following line to workaround the problem:
' cn.CursorLocation = adUseClient
' Open connection
cn.Open "Provider=MSDASQL;DSN=pubs;UID=<user name>;PWD=<strong password>;Database=pubs;"
' Error 3251 occurs at the following line.
Set rs_Events = cn.OpenSchema(adSchemaTables)
' As a test: Print all table names and types in your database.
Do Until rs_Events.EOF
Debug.Print "Table name: " & rs_Events!TABLE_NAME & _
vbCr & "Table type: " & rs_Events!TABLE_TYPE & vbCr
rs_Events.MoveNext
Loop
' Clean up objects.
rs_Events.Close
cn.Close
Set rs_Events = Nothing
Set cn = Nothing
Exit Sub
ErrHandler:
MsgBox Err.Number & ": " & Err.Description
End Sub
Keywords: kbbug kbfix kbado260fix kbmdac270fix kbdatabase kbado210sp2fix kbmdac260fix kbmdacnosweep kbado250fix KB195487