S1 will be the string "Date12", not the field Date12.
S2 will be the string "Day12"
S3 will be a string that reads "Date12 = [somedatevalue]"
No code has been executed to make that S3 string DO anything.
Try something like this
Code:
For X1 = 1 To 42
X2 = X1 + 1
S1 = "Date" & X1
S2 = "Day" & X1
With Forms
!frmMonthlyCalendar(S1) = StartDate + X1
If Month(frmMonthlyCalendar(S1)) <> Month(Date7) Then
!frmMonthlyCalendar(S1).BackColor = &HA5A5A5
!frmMonthlyCalendar(S2).BackColor = &HBFBFBF
End If
End With
Next X1
For efficiency, I'd really like to make that
Code:
With Forms!frmMonthlyCalendar
or
Code:
With Forms!frmMonthlyCalendar(S1)
but then I'd have to test whether the proper reference would be to .Item or .Value or whatever to make the rest of it work right. If anyone knows that off the top of their head, please feel free to school me with a code sample.