kod Private Sub kmtexcel_Click()
Dim runxls As New Excel.Application
Dim dosya As Excel.Workbook
Dim sayfa As Excel.Worksheet
Dim rs As New ADODB.Recordset
Set Excl = New Excel.Application
With Excl
.Application.Visible = True
.UserControl = True
End With
Set KTP = Excl.Workbooks.Add
Set SYF = KTP.Worksheets(1)
'BAŞLIKLAR DÜZENLENİYOR
With Excl
'***********************************
'rs.Open "SELECT * FROM [DEFTER KAYIT];", CurrentProject.Connection, adOpenKeyset, adLockReadOnly
rs.Open "Tüm_kayıt_excel", CurrentProject.Connection, adOpenKeyset, adLockReadOnly
x = 8
Do While rs.EOF = False
With Excl
.Cells(x, 1) = rs(1).Value
.Cells(x, 2) = rs(2).Value
.Cells(x, 3) = rs(3).Value
.Cells(x, 4) = rs(4).Value
.Cells(x, 5) = rs(5).Value
.Cells(x, 6) = rs(6).Value
.Cells(x, 7) = rs(7).Value
.Cells(x, 8) = rs(8).Value
.Cells(x, 9) = rs(9).Value
.Cells(x, 10) = rs(10).Value
.Cells(x, 11) = rs(11).Value
.Cells(x, 12) = rs(12).Value
.Cells(x, 13) = rs(13).Value
.Cells(x, 14) = rs(14).Value
.Cells(x, 15) = rs(15).Value
.Cells(x, 16) = rs(16).Value
End With
x = x + 1
rs.MoveNext
Loop
rs.Close
End With
End Sub
Sorfu yaptırmadan direk dataları
rs.Open "Tüm_kayıt_excel", CurrentProject.Connection, adOpenKeyset, adLockReadOnly
kodu ile Excele aktardım ama 2 tarih arasındaki kayıtları sorguda veya komutla kullanmayı yapamadım
yardımcı olursanız sevinirim