D
DS
I have a calendar form that essentially works.
I have 42 textoxes that fill with values 1 -31 depending on the month
but the problem is that after it gets to the End of the Month I get an
additional 6 days. I need to fill the textboxes "D" up to the last day
of the month. How can I correct this?
Thanks DS
Me.FirstDate = DateAdd("m", -1, FirstDate) 'decrease by 1 month
Dim curday As Variant, curbox As Integer
curday = DateSerial(Year(Forms!frmCalendarBlack![FirstDate]),
Month(Forms!frmCalendarBlack![FirstDate]), 1) 'first day of month
curday = DateAdd("d", 1 - Weekday(curday), curday) 'back to sunday
For curbox = 0 To 41 'need to loop thru 42 textboxes
Forms!frmCalendarBlack("D" & curbox) = Day(curday)
Forms!frmCalendarBlack("D" & curbox).Visible = False
If Month(curday) = Month(Forms!frmCalendarBlack!FirstDate) Then
Forms!frmCalendarBlack("D" & curbox).Visible = True
curday = curday + 1 'nextday
Next curbox
I have 42 textoxes that fill with values 1 -31 depending on the month
but the problem is that after it gets to the End of the Month I get an
additional 6 days. I need to fill the textboxes "D" up to the last day
of the month. How can I correct this?
Thanks DS
Me.FirstDate = DateAdd("m", -1, FirstDate) 'decrease by 1 month
Dim curday As Variant, curbox As Integer
curday = DateSerial(Year(Forms!frmCalendarBlack![FirstDate]),
Month(Forms!frmCalendarBlack![FirstDate]), 1) 'first day of month
curday = DateAdd("d", 1 - Weekday(curday), curday) 'back to sunday
For curbox = 0 To 41 'need to loop thru 42 textboxes
Forms!frmCalendarBlack("D" & curbox) = Day(curday)
Forms!frmCalendarBlack("D" & curbox).Visible = False
If Month(curday) = Month(Forms!frmCalendarBlack!FirstDate) Then
Forms!frmCalendarBlack("D" & curbox).Visible = True
curday = curday + 1 'nextday
Next curbox