Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
ADO data access to excel
Hi
Its not working : Sub ADOImportFromAccessTable(DBFullName As String, _ TableName As String, TargetRange As Range) Dim cn As ADODB.Connection, rs As ADODB.Recordset, intColIndex As Integer Dim pocz, kon As Date Set TargetRange = TargetRange.Cells(1, 1) Set cn = New ADODB.Connection cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _ DBFullName & ";" Set rs = New ADODB.Recordset pocz = InputBox("Od") kon = InputBox("Do") With rs .Open "SELECT * FROM " & TableName & _ " WHERE Początek pocz and koniec<kon", cn, , , adCmdText TargetRange.CopyFromRecordset rs ' End With rs.Close Set rs = Nothing cn.Close Set cn = Nothing End Sub ADOImportFromAccessTable "c:\Baza.mdb", "Postoje", ThisWorkbook.Worksheets("Arkusz2").Cells(1, 1) why ??? mrjoy |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
ADO data access to excel
Maybe
With rs .Open "SELECT * FROM " & TableName & _ " WHERE Początek " & pocz & " and koniec < #" & Format(kon,dd-mm-yyyy" &"#, cn, , , adCmdText -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "myrka" wrote in message ... Hi Its not working : Sub ADOImportFromAccessTable(DBFullName As String, _ TableName As String, TargetRange As Range) Dim cn As ADODB.Connection, rs As ADODB.Recordset, intColIndex As Integer Dim pocz, kon As Date Set TargetRange = TargetRange.Cells(1, 1) Set cn = New ADODB.Connection cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _ DBFullName & ";" Set rs = New ADODB.Recordset pocz = InputBox("Od") kon = InputBox("Do") With rs .Open "SELECT * FROM " & TableName & _ " WHERE Początek pocz and koniec<kon", cn, , , adCmdText TargetRange.CopyFromRecordset rs ' End With rs.Close Set rs = Nothing cn.Close Set cn = Nothing End Sub ADOImportFromAccessTable "c:\Baza.mdb", "Postoje", ThisWorkbook.Worksheets("Arkusz2").Cells(1, 1) why ??? mrjoy |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
ADO data access to excel
"Its not working". What does that mean ?
Error, wrong results, syntax ? You need to provide more details. Is the filed really called "Początek" ? NickHK "myrka" wrote in message ... Hi Its not working : Sub ADOImportFromAccessTable(DBFullName As String, _ TableName As String, TargetRange As Range) Dim cn As ADODB.Connection, rs As ADODB.Recordset, intColIndex As Integer Dim pocz, kon As Date Set TargetRange = TargetRange.Cells(1, 1) Set cn = New ADODB.Connection cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _ DBFullName & ";" Set rs = New ADODB.Recordset pocz = InputBox("Od") kon = InputBox("Do") With rs .Open "SELECT * FROM " & TableName & _ " WHERE Początek pocz and koniec<kon", cn, , , adCmdText TargetRange.CopyFromRecordset rs ' End With rs.Close Set rs = Nothing cn.Close Set cn = Nothing End Sub ADOImportFromAccessTable "c:\Baza.mdb", "Postoje", ThisWorkbook.Worksheets("Arkusz2").Cells(1, 1) why ??? mrjoy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can Excel access data from Access?! | Excel Discussion (Misc queries) | |||
How do I access the access data via Excel 2002 with auto update ? | Excel Programming | |||
Importing data from Access to Excel, but I need to vary the table from Access | Excel Programming | |||
Data too large for Excel, need to query Access data for results | Excel Programming | |||
Access data -work in Excel- save in Access | Excel Programming |