accessible
New member
- Local time
- Yesterday, 19:56
- Joined
- Oct 11, 2011
- Messages
- 5
Hello All
This should be easy, but as I'm not very experienced with VBA, it's not.
I have an Access 2010 database to hold employee data and I have a report to flag when a performance review is coming up, overdue or done.
The textbox (Date/Time type) that holds the review date is called [ReviewDate]. I use conditional formatting to turn the backcolor yellow if the date is less than 30 days from now, and that works.
If the review date is before today, I want the backcolor on the report to be red. If the value of the checkbox [ReviewDone] is yes, indicating the review has been completed, I want the backcolor to be white.
I'm not using conditional formatting for the red backcolor because it seems to take priority and ignore any VBA code about turning white if the box is checked.
So I wrote what should be simple code and put it in the report's Current event property, but absolutely nothing happens.
Private Sub Report_Current()
If Me.ReviewDate < Now() Then
Me.ReviewDate.BackColor = vbRed
ElseIf Me.ReviewDone = -1 Then
Me.ReviewDate.BackColor = vbWhite
End If
End Sub
I have similar code on the employee data input form and it works as it should, but the report doesn't work at all. Can anyone tell me where I'm off track?
Thanks in advance!
This should be easy, but as I'm not very experienced with VBA, it's not.
I have an Access 2010 database to hold employee data and I have a report to flag when a performance review is coming up, overdue or done.
The textbox (Date/Time type) that holds the review date is called [ReviewDate]. I use conditional formatting to turn the backcolor yellow if the date is less than 30 days from now, and that works.
If the review date is before today, I want the backcolor on the report to be red. If the value of the checkbox [ReviewDone] is yes, indicating the review has been completed, I want the backcolor to be white.
I'm not using conditional formatting for the red backcolor because it seems to take priority and ignore any VBA code about turning white if the box is checked.
So I wrote what should be simple code and put it in the report's Current event property, but absolutely nothing happens.
Private Sub Report_Current()
If Me.ReviewDate < Now() Then
Me.ReviewDate.BackColor = vbRed
ElseIf Me.ReviewDone = -1 Then
Me.ReviewDate.BackColor = vbWhite
End If
End Sub
I have similar code on the employee data input form and it works as it should, but the report doesn't work at all. Can anyone tell me where I'm off track?
Thanks in advance!