TUNCA ERSİN
Altın Üye
- Katılım
- 18 Ağustos 2021
- Mesajlar
- 131
- Excel Vers. ve Dili
- Office Professional plus 2016 Tr
- Altın Üyelik Bitiş Tarihi
- 18-08-2026
DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Option Explicit
Sub Report()
Dim My_Connection As Object, My_Query As String, My_Recordset As Object
Dim S1 As Worksheet, First_Date As Variant, Last_Date As Variant, Account_Name As String
Application.ScreenUpdating = False
Set My_Connection = CreateObject("AdoDB.Connection")
Set S1 = Sheets("onur")
First_Date = CLng(S1.Range("K1"))
Last_Date = CLng(S1.Range("N1"))
Account_Name = S1.Range("J2")
S1.Range("J4:M" & S1.Rows.Count).ClearContents
My_Connection.Open "Provider=Microsoft.Ace.OleDb.12.0;Data Source=" & _
ThisWorkbook.FullName & ";Extended Properties=""Excel 12.0;Hdr=Yes"""
My_Query = "Select [Fiş Tarihi],[Ek Açıklama],[Borçlu],[Alacaklı] From [Muavin$] " & _
"Where [Fiş Tarihi] Between " & First_Date & " And " & Last_Date & " And [Hesap Adı] = '" & Account_Name & "'"
Set My_Recordset = My_Connection.Execute(My_Query)
S1.Range("J4").CopyFromRecordset My_Recordset
If My_Recordset.State <> 0 Then My_Recordset.Close
If My_Connection.State <> 0 Then My_Connection.Close
Set S1 = Nothing
Set My_Recordset = Nothing
Set My_Connection = Nothing
Application.ScreenUpdating = True
MsgBox "İşleminiz tamamlanmıştır.", vbInformation
End Sub