Kod:
Public Function NobetHaftaIciSonu(kimo, Zaman As Long, Hangi As String) As Integer
Dim Veri As New ADODB.Recordset, Sayac, Hft(1), Hane As Long
Veri.Open "SELECT TblNobet.* FROM TblNobet " & _
"WHERE (((TblNobet.OgretmenId)=" & kimo & ") AND ((Format(" & IIf(CLng(Right(Zaman, 2)) > 0, "[donem],'yyyymm'", "[donem],'yyyy'") & "))=" & IIf(CLng(Right(Zaman, 2)) > 0, Zaman, Left(Zaman, 4)) & ")) Order By [donem]", CurrentProject.Connection, adOpenKeyset, adLockReadOnly
If CLng(Right(Zaman, 2)) = 0 Then Debug.Print Veri.Source
If Veri.RecordCount = 0 Then Exit Function
Do Until Veri.EOF
For Sayac = 1 To 31
If Veri("G" & Sayac) = "N" Then
Hane = IIf(Eval(Weekday(DateSerial(Left(Zaman, 4), Right(Zaman, 2), Sayac), vbMonday) & " In (5,6,7)"), 1, 0)
Hft(Hane) = Hft(Hane) + 1
End If
Next Sayac
Sayac = 1
Veri.MoveNext
Loop
Veri.Close
Set Veri = Nothing
NobetHaftaIciSonu = Hft(IIf(Hangi = "N", 0, 1))
End Function
Kod:
If Veri("G" & Sayac) = "N" Then
Kod:
If Veri("G" & Sayac) = "N" or "B" Then