View Full Version : Conditionally highlight report controls.


ChrisO
11-26-2005, 05:11 PM
Behind the Report: -

Option Explicit
Option Compare Text


Private Sub Detail_Format(ByRef intCancel As Integer, _
ByRef intFormatCount As Integer)

' If overdue exceeds $2000.00, highlight the control
If Me.txtTotalOverdue > 2000 Then
' Draw red ellipse around Me.txtTotalOverdue
HighlightControl Me.txtTotalOverdue, vbRed, 0.35
End If

End Sub


In a standard module: -

Option Explicit
Option Compare Text


Public Sub HighlightControl(ByRef ctlControl As Control, _
ByVal lngColour As Long, _
ByVal sngAspect As Single)

With ctlControl
' Remove the current border.
.BorderStyle = 0

' Draw the ellipse relative to the control.
.Parent.Circle (.Left + .Width / 2, _
.Top + .Height / 2), _
.Width / 2 + 50, _
lngColour, , , _
sngAspect
End With

End Sub

Should be good to go in all versions of Access.

EDIT:
Spelling mistake.

EDIT2:
One ctlControl too many.


Regards,
Chris.