Hi Everyone.
I have a UserForm where the user must update the Public Holidays (South African) for the year. Basically the user must only change the year and then the date of Easter Friday. All the other dates will auto update in the relevant Table ("tblPPH") In this UserForm, there will be a complete list of all the Public Holidays' names as Labels as well as the date. Also a label, but only the day and month. There is a TextBox for the year at the top of the userform. There is also a TextBox for the date of Easter Friday.
At the end of the year, when the new years' holiday dates need to be updated, the user only changes the year in the relevant TextBox. I have some code that runs after the year is changed.
I would like to change the Label's front color to change to red if the Public Holiday falls on a Sunday.
Please help.
There are 10 holidays that must be tested if it falls on a Sunday. All the labels are:
Me.lNewYears
Me.lHumanRights
Me.lGoodFriday
Me.lEasterSunday
Me.lFamDay
Me.lFreedom
Me.lWorkers
Me.lYouth
Me.lWomens
Me.lHeritage
Me.lRecon
Me.lChristmas
The dates on the UserForm is named similarly, but with pph instead of l.
I have a UserForm where the user must update the Public Holidays (South African) for the year. Basically the user must only change the year and then the date of Easter Friday. All the other dates will auto update in the relevant Table ("tblPPH") In this UserForm, there will be a complete list of all the Public Holidays' names as Labels as well as the date. Also a label, but only the day and month. There is a TextBox for the year at the top of the userform. There is also a TextBox for the date of Easter Friday.
At the end of the year, when the new years' holiday dates need to be updated, the user only changes the year in the relevant TextBox. I have some code that runs after the year is changed.
I would like to change the Label's front color to change to red if the Public Holiday falls on a Sunday.
Code:
Private Sub tbYear_AfterUpdate()
Dim tblPPH As ListObject
Set tblPPH = ShInstructions.ListObjects("PublicHolidays")
'Test for Sunday
If Me.pphWomens & Me.tbYear = "09 August" & Me.tbYear Then ' I need this line to check for Sunday ("09 August" & Me.tbYear)
Me.lWomens.ForeColor = &HFF&
Else
Me.lWomens.ForeColor = &H80000008
End If
End Sub
Please help.
There are 10 holidays that must be tested if it falls on a Sunday. All the labels are:
Me.lNewYears
Me.lHumanRights
Me.lGoodFriday
Me.lEasterSunday
Me.lFamDay
Me.lFreedom
Me.lWorkers
Me.lYouth
Me.lWomens
Me.lHeritage
Me.lRecon
Me.lChristmas
The dates on the UserForm is named similarly, but with pph instead of l.