Option Explicit
Sub Update_The_Last_Task_Date()
Dim S1 As Worksheet, S2 As Worksheet
Dim My_Connection As Object, My_Recordset As Object
Dim My_Query As String, Process_Time As Double
Set S1 = Sheets("GörevTanımlama")
Set S2 = Sheets("Görevlendirmeler")
Process_Time = Timer
Set My_Connection = VBA.CreateObject("AdoDb.Connection")
My_Connection.Open "Provider=Microsoft.Ace.OleDb.12.0;Data Source=" & _
ThisWorkbook.FullName & ";Extended Properties=""Excel 12.0;Hdr=Yes"""
My_Query = "Select * From [" & S2.Name & "$] Where [ADI SOYADI] = '" & S1.Range("C2") & _
"' And [GÖREVLENDİRİLDİĞİ YER] = '" & S1.Range("C3") & _
"' And [DÖNÜŞ TARİHİ] = " & CLng(CDate(S1.Range("C5"))) & ""
Set My_Recordset = My_Connection.Execute(My_Query)
If My_Recordset.EOF Then
My_Query = "Update [" & S2.Name & "$] Set [DÖNÜŞ TARİHİ] = " & _
CLng(CDate(S1.Range("C5"))) & " Where [ADI SOYADI] = '" & S1.Range("C2") & _
"' And [GÖREVLENDİRİLDİĞİ YER] = '" & S1.Range("C3") & _
"' And [DÖNÜŞ TARİHİ] = " & CLng(CDate(S1.Range("C4"))) & ""
My_Connection.Execute My_Query
MsgBox "Görev tarihi güncellenmiştir." & vbCrLf & vbCrLf & _
"İşlem süresi ; " & Format(Timer - Process_Time, "0.00") & " Saniye", vbInformation
End If
If My_Recordset.State <> 0 Then My_Recordset.Close
If My_Connection.State <> 0 Then My_Connection.Close
Set My_Connection = Nothing
Set My_Recordset = Nothing
Set S1 = Nothing
Set S2 = Nothing
End Sub