neilsolaris
Member
- Local time
- Today, 01:23
- Joined
- Apr 19, 2020
- Messages
- 114
Hi,
My aim is to reference an Access table from Excel. I found a Youtube clip that has code to achieve this, however, I get an error when I execute a line. I've posted what I have so far (see below). It's the very last line (Connection.Open ConnectionString = Connect) that causes the error message. I get run-time error, Automaton error, Unspecified error. I should add, I ticked to enable the Microsoft Activex Data Objects 2.0 Library in the references. Also, I'm using Excel and Access 2007.
Any ideas what I'm doing wrong? Many thanks for your help.
Sub GetDataFromAccess()
Dim DBFullName As String
Dim Connect As String, Source As String
Dim Connection As ADODB.Connection
Dim Recordset As ADODB.Recordset
Dim Col As Integer
DBFullName = "D:\Documents\Orchestra\Musicians Details\ Orchestra.accdb"
Set Connection = New ADODB.Connection
Connect = "Provider=Microsoft.ACE.OLEDB.12.0;"
Connect = Connect & "Data Source=" & DBFullName & ";"
Connection.Open ConnectionString = Connect
End Sub
My aim is to reference an Access table from Excel. I found a Youtube clip that has code to achieve this, however, I get an error when I execute a line. I've posted what I have so far (see below). It's the very last line (Connection.Open ConnectionString = Connect) that causes the error message. I get run-time error, Automaton error, Unspecified error. I should add, I ticked to enable the Microsoft Activex Data Objects 2.0 Library in the references. Also, I'm using Excel and Access 2007.
Any ideas what I'm doing wrong? Many thanks for your help.
Sub GetDataFromAccess()
Dim DBFullName As String
Dim Connect As String, Source As String
Dim Connection As ADODB.Connection
Dim Recordset As ADODB.Recordset
Dim Col As Integer
DBFullName = "D:\Documents\Orchestra\Musicians Details\ Orchestra.accdb"
Set Connection = New ADODB.Connection
Connect = "Provider=Microsoft.ACE.OLEDB.12.0;"
Connect = Connect & "Data Source=" & DBFullName & ";"
Connection.Open ConnectionString = Connect
End Sub