G
Guest
Can anyone tell me what is wrong with this code.
There are 42 boxes on my form with 4 text boxes each. Each box represents a
day of the week. The boxes are named D1-D42, F1-F42, R1-R42, & B1-B42. The
"D" represents the # of the day on the calendar. F, R, & B is info that is
pulled from a query. What I am trying to do is show a cumalitive for each
day, based on the 3 categories.
Dim CurDay, CurDayFlat, CurDayRot, CurDayB
Dim FTally, RTally, BTally As Long
Dim rs As recordset
Dim db As Database
For x = 1 To 42
With rs
Do While Not rs.EOF
CurDay = Me("D" & x)
CurDayFlat = ("F" & x)
CurDayRot = ("R" & x)
CurDayB = ("B" & x)
If ![Date Due] = CurDay And ![PSAbrv] = "F" Then
FTally = ![SP_Est] + FTally
Me(CurDayFlat) = FTally
End If
If ![Date Due] = CurDay And ![PSAbrv] = "R" Then
RTally = ![SP_Est] + RTally
Me(CurDayRot) = RTally
End If
If ![Date Due] = CurDay And ![PSAbrv] = "B" Then
BTally = ![SP_Est] + BTally
Me(CurDayB) = BTally
End If
rs.MoveNext
Loop
End With
Next x
There are 42 boxes on my form with 4 text boxes each. Each box represents a
day of the week. The boxes are named D1-D42, F1-F42, R1-R42, & B1-B42. The
"D" represents the # of the day on the calendar. F, R, & B is info that is
pulled from a query. What I am trying to do is show a cumalitive for each
day, based on the 3 categories.
Dim CurDay, CurDayFlat, CurDayRot, CurDayB
Dim FTally, RTally, BTally As Long
Dim rs As recordset
Dim db As Database
For x = 1 To 42
With rs
Do While Not rs.EOF
CurDay = Me("D" & x)
CurDayFlat = ("F" & x)
CurDayRot = ("R" & x)
CurDayB = ("B" & x)
If ![Date Due] = CurDay And ![PSAbrv] = "F" Then
FTally = ![SP_Est] + FTally
Me(CurDayFlat) = FTally
End If
If ![Date Due] = CurDay And ![PSAbrv] = "R" Then
RTally = ![SP_Est] + RTally
Me(CurDayRot) = RTally
End If
If ![Date Due] = CurDay And ![PSAbrv] = "B" Then
BTally = ![SP_Est] + BTally
Me(CurDayB) = BTally
End If
rs.MoveNext
Loop
End With
Next x