Hi All,
Wondering if you can help. I'm fairly new to access and VB code so I cant quite figure where this is going wrong.
In a report I have put some code to the OnLoad event.
I'm wanting to highlight a field (combo) red if the current date is later than that of another field.
My problem is that the field back colour is changing no matter what the result is. I have tried adding a Else statement in with a random colour but this made no difference either.
Any help would be appreciated.
Code is below.
Option Compare Database
Private Sub Report_Load()
Dim OverduePlant As Date
Dim IngRed As Long
Dim IngNormal As Long
OverduePlant = ExpectedOffHire
IngRed = RGB(255, 0, 0)
IngNormal = RGB(900, 0, 0)
If Date = OverduePlant Then
PlantItem.BackColor = IngRed
Else
PlantItem.BackColor = IngNormal
End If
End Sub
[/SIZE]
[/FONT]
Wondering if you can help. I'm fairly new to access and VB code so I cant quite figure where this is going wrong.
In a report I have put some code to the OnLoad event.
I'm wanting to highlight a field (combo) red if the current date is later than that of another field.
My problem is that the field back colour is changing no matter what the result is. I have tried adding a Else statement in with a random colour but this made no difference either.
Any help would be appreciated.
Code is below.
Option Compare Database
Private Sub Report_Load()
Dim OverduePlant As Date
Dim IngRed As Long
Dim IngNormal As Long
OverduePlant = ExpectedOffHire
IngRed = RGB(255, 0, 0)
IngNormal = RGB(900, 0, 0)
If Date = OverduePlant Then
PlantItem.BackColor = IngRed
Else
PlantItem.BackColor = IngNormal
End If
End Sub
[/SIZE]
[/FONT]