出于某种原因,一周中的每一天都填充有“定时”。我正在测试一个空值,但似乎在表中没有看到任何值
我正在使用DLookup来测试该值是否正确,似乎工作正常。
Dim i As Integer
Dim j As Integer
Dim db As DAO.Database
Dim wc As DAO.Recordset
Dim stc As DAO.Recordset
Set db = CurrentDb
Set wc = db.OpenRecordset("Weekly_Challenges")
Set stc = db.OpenRecordset("Weekly_StartTime_Challenges")
amRoutine = DLookup("AMRoutineStartTime", "Standard_Actions", "UserId=" & Me.UserID.Value & " And WeekNumber=" & Me.WeekNumber)
If Form_Weekly_Challenges_subform.StandardAction.Value = "AM Routine" Then
If amRoutine = -1 Then
For i = 0 To stc.RecordCount - 1
If stc.Fields("StartTimeAction") = "AM Routine" Then
For j = 0 To wc.RecordCount - 1
If wc.Fields("StandardAction") = "AM Routine" Then
If stc.Fields("Monday") = Null Then
wc.Edit
wc.Fields("Monday") = ""
wc.Update
Else
wc.Edit
wc.Fields("Monday") = "Timed"
wc.Update
End If
If stc.Fields("Tuesday") = Null Then
wc.Edit
wc.Fields("Tuesday") = ""
wc.Update
Else
wc.Edit
wc.Fields("Tuesday") = "Timed"
wc.Update
End If
If stc.Fields("Wednesday") = Null Then
wc.Edit
wc.Fields("Wednesday") = ""
wc.Update
Else
wc.Edit
wc.Fields("Wednesday") = "Timed"
wc.Update
End If
If stc.Fields("Thursday") = Null Then
wc.Edit
wc.Fields("Thursday") = ""
wc.Update
Else
wc.Edit
wc.Fields("Thursday") = "Timed"
wc.Update
End If
If stc.Fields("Friday") = Null Then
wc.Edit
wc.Fields("Friday") = ""
wc.Update
Else
wc.Edit
wc.Fields("Friday") = "Timed"
wc.Update
End If
If stc.Fields("Saturday") = Null Then
wc.Edit
wc.Fields("Saturday") = ""
wc.Update
Else
wc.Edit
wc.Fields("Saturday") = "Timed"
wc.Update
End If
If stc.Fields("Sunday") = Null Then
wc.Edit
wc.Fields("Sunday") = ""
wc.Update
Else
wc.Edit
wc.Fields("Sunday") = "Timed"
wc.Update
End If
End If
wc.MoveNext
Next j
End If
stc.MoveNext
Next i
End If
Else
End If
星期一,星期三和星期五应设置为“定时”,其余应为空