G
Guest
In my report, I'm trying to set the border color, fore color & back color of
the EDSDisplay control depending on the value of the EDS control. I've tried
to change the below code a few different ways and I either get an error
message or it comes up with the wrong color. Any idea what I'm doing wrong.
Thank you
Private Sub Report_Open(Cancel As Integer)
Dim EDS As Integer
Dim EDSDisplay As Integer
Dim lngBlack As Long
Dim lngRed As Long, lngYellow As Long, lngWhite As Long
Dim lngGreen As Long
If Not IsNull(Me!EDSDisplay.Value) Then
EDS = Me!EDSDisplay.Value
Else
Exit Sub
End If
lngRed = RGB(255, 0, 0)
lngGreen = RGB(0, 255, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)
lngBlack = RGB(0, 0, 0)
If EDS > 0 Then
Me!EDSDisplay.BorderColor = lngGreen
Me!EDSDisplay.ForeColor = lngBlack
Me!EDSDisplay.BackColor = lngGreen
ElseIf EDS = 3 Then
Me!EDSDisplay.BorderColor = lngRed
Me!EDSDisplay.ForeColor = lngBlack
Me!EDSDisplay.BackColor = lngRed
ElseIf EDS = 0 Then
Me!EDSDisplay.BorderColor = lngYellow
Me!EDSDisplay.ForeColor = lngBlack
Me!EDSDisplay.BackColor = lngYellow
Else
Me!EDSDisplay.BorderColor = lngGreen
Me!EDSDisplay.ForeColor = lngBlack
Me!EDSDisplay.BackColor = lngGreen
End If
End Sub
the EDSDisplay control depending on the value of the EDS control. I've tried
to change the below code a few different ways and I either get an error
message or it comes up with the wrong color. Any idea what I'm doing wrong.
Thank you
Private Sub Report_Open(Cancel As Integer)
Dim EDS As Integer
Dim EDSDisplay As Integer
Dim lngBlack As Long
Dim lngRed As Long, lngYellow As Long, lngWhite As Long
Dim lngGreen As Long
If Not IsNull(Me!EDSDisplay.Value) Then
EDS = Me!EDSDisplay.Value
Else
Exit Sub
End If
lngRed = RGB(255, 0, 0)
lngGreen = RGB(0, 255, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)
lngBlack = RGB(0, 0, 0)
If EDS > 0 Then
Me!EDSDisplay.BorderColor = lngGreen
Me!EDSDisplay.ForeColor = lngBlack
Me!EDSDisplay.BackColor = lngGreen
ElseIf EDS = 3 Then
Me!EDSDisplay.BorderColor = lngRed
Me!EDSDisplay.ForeColor = lngBlack
Me!EDSDisplay.BackColor = lngRed
ElseIf EDS = 0 Then
Me!EDSDisplay.BorderColor = lngYellow
Me!EDSDisplay.ForeColor = lngBlack
Me!EDSDisplay.BackColor = lngYellow
Else
Me!EDSDisplay.BorderColor = lngGreen
Me!EDSDisplay.ForeColor = lngBlack
Me!EDSDisplay.BackColor = lngGreen
End If
End Sub