ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to use ADODB in Excel 2003 (https://www.excelbanter.com/excel-programming/352592-how-use-adodb-excel-2003-a.html)

alpder[_3_]

How to use ADODB in Excel 2003
 

I wish to run code in excel 2003 which opens an access 2003 database and
retrieves some data from it. I am running XP SP2 and have installed MDAC
2.8 SP1, but still cannot get it to work. I get "Run-time error 3706.
Provider cannot be found. It may not be properly installed."

Does anyone have any ideas?


--
alpder
------------------------------------------------------------------------
alpder's Profile: http://www.excelforum.com/member.php...o&userid=28547
View this thread: http://www.excelforum.com/showthread...hreadid=509194


Dave Patrick

How to use ADODB in Excel 2003
 
Try something like this;

Public Sub testing()
Dim cnn As ADODB.Connection
Dim rs1 As ADODB.Recordset
Dim strSQL1 As String, strConn
Dim i As Integer
i = 1
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=C:\Program Files\Microsoft Office\" _
& "OFFICE11\SAMPLES\Northwind.mdb;Persist Security Info=False"
strSQL1 = "SELECT EmployeeID, LastName, FirstName " _
& "FROM Employees; "
Set cnn = New ADODB.Connection
Set rs1 = New ADODB.Recordset
cnn.Open strConn
rs1.Open strSQL1, cnn, adOpenForwardOnly, adLockReadOnly
Do While rs1.EOF = False
Sheets("Sheet1").Range("A" & i) = rs1!EmployeeID
Sheets("Sheet1").Range("B" & i) = rs1!LastName
Sheets("Sheet1").Range("C" & i) = rs1!FirstName
i = i + 1
rs1.MoveNext
Loop
rs1.Close
cnn.Close
End Sub

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"alpder" wrote:
|
| I wish to run code in excel 2003 which opens an access 2003 database and
| retrieves some data from it. I am running XP SP2 and have installed MDAC
| 2.8 SP1, but still cannot get it to work. I get "Run-time error 3706.
| Provider cannot be found. It may not be properly installed."
|
| Does anyone have any ideas?
|
|
| --
| alpder
| ------------------------------------------------------------------------
| alpder's Profile:
http://www.excelforum.com/member.php...o&userid=28547
| View this thread: http://www.excelforum.com/showthread...hreadid=509194
|



Ron de Bruin

How to use ADODB in Excel 2003
 
Hi alpder

Maybe this page is useful
http://www.rondebruin.nl/accessexcel.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl


"alpder" wrote in message
...

I wish to run code in excel 2003 which opens an access 2003 database and
retrieves some data from it. I am running XP SP2 and have installed MDAC
2.8 SP1, but still cannot get it to work. I get "Run-time error 3706.
Provider cannot be found. It may not be properly installed."

Does anyone have any ideas?


--
alpder
------------------------------------------------------------------------
alpder's Profile: http://www.excelforum.com/member.php...o&userid=28547
View this thread: http://www.excelforum.com/showthread...hreadid=509194





All times are GMT +1. The time now is 07:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com