The large block of coding below successfully conditionally formats the StartDate field's backcolor to yellow from the beginning of the current month to the current date.
And if you want to know how to get some other dates replace the following snippets into above coding.
Last day of the month
First day of next month
Last day of next month
…and so on.
WHAT I’D LIKE TO KNOW IS HOW TO DO THIS FOR THE FIRST DAY OF THE WEEK TO THE LAST DAY OF THE WEEK.
Code:
Private Sub Form_Open(Cancel As Integer)
Dim fcd As FormatCondition
With StartDate
With .FormatConditions
.Delete
Set fcd = .Add(acFieldValue, acBetween, _
"#" & Format(DateSerial(Year(Date), Month(Date), 1), "mm-dd-yyyy") & "#" _
, "#" & Format( _
Date, "mm-dd-yyyy") & "#")
fcd.BackColor = vbYellow
End With
End With
End Sub
And if you want to know how to get some other dates replace the following snippets into above coding.
Last day of the month
Code:
DateSerial(Year(Date), Month(Date) + 1, 0)
Code:
DateSerial(Year(Date), Month(Date) + 1, 1)
Code:
DateSerial(Year(Date), Month(Date) + 2, 0)
WHAT I’D LIKE TO KNOW IS HOW TO DO THIS FOR THE FIRST DAY OF THE WEEK TO THE LAST DAY OF THE WEEK.