pedie
Well-known Member
- Joined
- Apr 28, 2010
- Messages
- 3,875
I got this code from web...does not work with me...
Error "runtime error 2147467259...80004005.
[MS ODBC driver manager] Data source bame not found and no default driver specified..."
Is there any settings i need to take care of before running this code. besides the reference that i did for MS ADO ...?
Thanks for taking care of this.
Pedie
Code:
[/FONT]
[FONT=Courier New][/FONT]
[FONT=Courier New]Option Explicit
Sub exceltoAcc()[/FONT]
[FONT=Courier New]Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim startrow As Long[/FONT]
[FONT=Courier New]con.ConnectionString = "DBQ=E:\Personal_Files\ADO_Excel_Acess\MyDB.mdb;" & "Driver=(Microsoft Access Driver (*.mdb));"[/FONT]
[FONT=Courier New]con.Open[/FONT]
[FONT=Courier New]Set rs.ActiveConnection = con
rs.Open "Select ' from MyTB"[/FONT]
[FONT=Courier New]startrow = 3[/FONT]
[FONT=Courier New]Do Until rs.EOF[/FONT]
[FONT=Courier New]Cells(startrow, 4) = rs.Fields(0).Value
Cells(startrow, 5) = rs.Fields(1).Value
rs.MoveNext
startrow = startrow + 1
Loop
rs.Close
Set rs = Nothing
con.Close
Set con = Nothing[/FONT]
[FONT=Courier New]End Sub
[/FONT]
[FONT=Courier New][/FONT]
[FONT=Courier New]