I've searched the blogs and cannot find my scenario, in trying to debug... I am using Excel 2000 to connect to Access 2000. I get this Runtime error -2147467259 Automation error Unspecified error.
My basic goal is to connect to Access and retrieve a record set into a temp table. Any help would be greatly appreciated.
I compare my references to those recommended yet I don't see what I am missing...References:
Visual Basic for Applications
Microsoft Excel 10.0 Object Library
OLE Automation
Microsoft Office 10.0 Object Library
Microsoft ActiveX Data Objects 6.0 Library
Microsoft Data Access Components Installed Version
******* BEGIN CODE ************
Sub ImportFromAccess()
Dim DBFullName As String
Dim TableName As String, TargetRange As Range
Dim cn As ADODB.Connection, rs As ADODB.Recordset, intColIndex As Integer
Dim dtDay1 As Date
DBFullName = "C:\Users\Owner\Documents\KH.mdb"
TableName = "Clients"
dtDay1 = Range("C9").Value
' open the database
Set cn = New ADODB.Connection
'****** ERROR HAPPEN HERE cn.Open *******
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=DBFullName;"
'************END ERROR*******************
Set rs = New ADODB.Recordset
With rs
' open the recordset
.Open "SELECT count(*) FROM " & TableName & _
" WHERE date = " & dtDay1, cn, , , adCmdText
' filter records
'********** END CODE
[blue]Kathy,
Bus Sys Analyst[/blue]
"I am always doing that which I can not do, in order that I may learn how to do it."– Pablo Picasso
The person who says it can't be done shouldn't interrupt the person who is doing it.—Chinese Proverb
My basic goal is to connect to Access and retrieve a record set into a temp table. Any help would be greatly appreciated.
I compare my references to those recommended yet I don't see what I am missing...References:
Visual Basic for Applications
Microsoft Excel 10.0 Object Library
OLE Automation
Microsoft Office 10.0 Object Library
Microsoft ActiveX Data Objects 6.0 Library
Microsoft Data Access Components Installed Version
******* BEGIN CODE ************
Sub ImportFromAccess()
Dim DBFullName As String
Dim TableName As String, TargetRange As Range
Dim cn As ADODB.Connection, rs As ADODB.Recordset, intColIndex As Integer
Dim dtDay1 As Date
DBFullName = "C:\Users\Owner\Documents\KH.mdb"
TableName = "Clients"
dtDay1 = Range("C9").Value
' open the database
Set cn = New ADODB.Connection
'****** ERROR HAPPEN HERE cn.Open *******
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=DBFullName;"
'************END ERROR*******************
Set rs = New ADODB.Recordset
With rs
' open the recordset
.Open "SELECT count(*) FROM " & TableName & _
" WHERE date = " & dtDay1, cn, , , adCmdText
' filter records
'********** END CODE
[blue]Kathy,
Bus Sys Analyst[/blue]
"I am always doing that which I can not do, in order that I may learn how to do it."– Pablo Picasso
The person who says it can't be done shouldn't interrupt the person who is doing it.—Chinese Proverb