Refereejohn
New member
- Local time
- Yesterday, 23:33
- Joined
- Apr 15, 2018
- Messages
- 2
I have around ten dates in an Access form I want to change the colour orange or amber (to indicate a warning in my [30DaysDate] thirty days to go) and when the anniversary date [EDEDateStart] arrives ten will turn red, these are mandatory learning dates for e-learning. I have tried the following code for the first experiment: -
Private Sub Form_Load()
Dim Orange As Long
Orange = RGB(255, 165, 0)
If [30DaysDate] - [EDEStartDate] <= 30 Then [30DaysDate.BackStyle] = Orange
Else: [30DaysDate.BackStyle] = 0
End If
End Sub
Being a novice I am uncertain if I can use the If Function for this. Even if I use an Expression in Conditional Formatting I would need the date the e-learning started to remain a constant (Date() would always be the current date). I would have to repeat the code with name changes I know but if I could find a code that would do this I’d be grateful. The amber or orange Backcolour would trigger thirty days before the anniversary date with the EDEStartDate turning red when the person went out of compliance - I also get an End without If error?:banghead:
Private Sub Form_Load()
Dim Orange As Long
Orange = RGB(255, 165, 0)
If [30DaysDate] - [EDEStartDate] <= 30 Then [30DaysDate.BackStyle] = Orange
Else: [30DaysDate.BackStyle] = 0
End If
End Sub
Being a novice I am uncertain if I can use the If Function for this. Even if I use an Expression in Conditional Formatting I would need the date the e-learning started to remain a constant (Date() would always be the current date). I would have to repeat the code with name changes I know but if I could find a code that would do this I’d be grateful. The amber or orange Backcolour would trigger thirty days before the anniversary date with the EDEStartDate turning red when the person went out of compliance - I also get an End without If error?:banghead: