M
myrka
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
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