Good afternoon,
Below is a modified version of code I found in the internet. When the code gets to oRecordset.Open mySQL, I get a run-time error 3709. I'm pretty certain that I have all of the library references set up properly. There is something wrong with the creation of my recordset. Do you know what I am doing wrong?
Sub test2()
Set OConnection = New ADODB.Connection
Dim oRecordset As ADODB.Recordset
Set oRecordset = New ADODB.Recordset
OConnection.Open "provider=sqloledb;data source=TheServerName;" & _
"Trusted_Connection=yes;initial catalog=TheTable;"
'check connection status
MsgBox OConnection.State
'get names of tables
Set rs = OConnection.OpenSchema(adSchemaTables)
While Not rs.EOF
Debug.Print rs!TABLE_NAME
rs.MoveNext
Wend
mySQL = "SELECT * FROM REAL_PROPERTY_MULTIPLE;"
MsgBox OConnection.State
MsgBox mySQL
oRecordset.Open mySQL
OConnection.Close
End Sub
Bookmarks