Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 | |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
access database (adodb)from excel vba | Excel Worksheet Functions | |||
share adodb connection in excel | Excel Programming | |||
adodb.recordset with excel | Excel Programming | |||
Virus - importing excel via adodb connection | Excel Programming | |||
Export from Excel to Access ADODB | Excel Programming |