27/05/2021, 00:27
berduş
SaatTpl fonksiyonunun kodunu aşağıdaki gibi düzenleyip dener misiniz?
Private Sub SaatTpl(Optional id As Long)
StrAlan = ""
For x = 1 To 31
StrDgr = Format(x, "00")
Gunsay = Gunsay & "+ IIf(IsNumeric(E" & StrDgr & ") , 1,0)"
StrDgr = "IIf(IsNumeric(E" & StrDgr & ") , E" & StrDgr & ",0)"
StrAlan = StrAlan & "+" & StrDgr
Next x
Gunsay = "(0 " & Gunsay & ")"
SqlUpdt = "Update [EKDERS] " & _
"SET [ETOPSAAT] =" & StrAlan
If id > 0 Then SqlUpdt = SqlUpdt & " where ID=" & id
CurrentDb.Execute SqlUpdt
SqlUpdt = "Update [EKDERS] " & _
"SET [MESAI]=IIf([ETOPSAAT]-10*" & Gunsay & ">0,([ETOPSAAT]-(10*" & Gunsay & ")),0)"
If id > 0 Then SqlUpdt = SqlUpdt & " where ID=" & id
CurrentDb.Execute SqlUpdt
End Sub