Private Sub TmListeGncl()
Dim RsLstS As Recordset
Dim RsLst As Recordset
Dim MtnSql, MtnKosul, MtnBirim, MtnMadde1, MtnMadde2, MtnMadde3, MtnSureByk, MtnSureKck, MtnBasTrh, MtnBitTrh As String
Dim MtnKosulDlk, MtnBirimDlk, MtnMadde1Dlk, MtnMadde2Dlk, MtnMadde3Dlk, MtnSureBykDlk, MtnSureKckDlk, MtnBasTrhDlk, MtnBitTrhDlk As String
Dim ImYr As Long
ImYr = Me.ActiveControl.SelStart
Me.ActiveControl.Value = Me.ActiveControl.Text
Me.ActiveControl.SelStart = ImYr
MtnBirim = IIf(Len(BİRİMKutusu & "") < 1, "", " and ([İlkgrup_adi] Like '*" & BİRİMKutusu & "*')")
MtnMadde1 = IIf(Len(MADDE1Kutusu & "") < 1, "", " and ([olay_turu] Like '*" & MADDE1Kutusu & "*')")
MtnMadde2 = IIf(Len(MADDE2Kutusu & "") < 1, "", " and ([olay_cins] Like '*" & MADDE2Kutusu & "*')")
MtnMadde3 = IIf(Len(MADDE3Kutusu & "") < 1, "", " and ([vardiya] Like '*" & MADDE3Kutusu & "*')")
MtnSureByk = IIf(Len(SureUst & "") < 1, "", " and ([CikisSure]>=" & Me.SureUst & "*60)")
MtnSureKck = IIf(Len(SureAlt & "") < 1, "", " and ([CikisSure]<=" & Me.SureAlt & "*60)")
MtnBasTrh = IIf(Len(ilk_tarih & "") < 1, "", " and ([olay_tarihi]>=clng(CDate('" & Me.ilk_tarih & "')))")
MtnBitTrh = IIf(Len(son_tarih & "") < 1, "", " and ([olay_tarihi]<=clng(CDate('" & Me.son_tarih & "')))")
MtnKosul = MtnBirim & MtnMadde1 & MtnMadde2 & MtnMadde3 & MtnSureByk & MtnSureKck & MtnBasTrh & MtnBitTrh
Set RsLst = CurrentDb.OpenRecordset("sorgu1Krt", dbOpenDynaset) 'Me.TümListe.Recordset.OpenRecordset
MtnKosul = Mid(MtnKosul, 5)
RsLst.Filter = MtnKosul
Set RsLstS = RsLst.OpenRecordset
If RsLstS.RecordCount = 0 Then GoTo 10
RsLstS.MoveLast
Set Me.TümListe.Recordset = RsLstS.OpenRecordset
KytVrsSure = RsLstS.RecordCount
'Hesaplamalar________________________________________________
'hy CikisSure süre ortalaması 'sadece değer olan kayıtlar için
tplVrsSure = Dsum ("Nz([CikisSure],0)", RsLstS.Name, MtnKosul)
'hy varış süre ortalaması 'sadece değer olan kayıtlar için
tplCksSure = Dsum ("Nz([VarisSure],0)", RsLstS.Name, MtnKosul)
'hy mesafe ortalaması sadece değer olan kayıtlar için
tplCksMsf = Dsum ("Nz([mesafe],0)", RsLstS.Name, MtnKosul)
If KytVrsSure <> 0 Then
Me.Metin1 = Sny2Sure(tplCksSure / KytVrsSure)
Me.Metin2.Value = KytVrsSure
Me.Metin85 = tplCksMsf / KytVrsSure
Me.Metin92 = Sny2Sure(tplVrsSure / KytVrsSure)
Else
10
Metin1 = ""
Metin2 = 0
Metin85 = ""
Metin92 = ""
End If
'dsum("[mar]",rst.Name)
End Sub
TmListeGncl fonksiyonu aşağıdaki gibi daha da sadeleştirilebilir