Conditionally highlight report controls. (1 Viewer)

Status
Not open for further replies.

ChrisO

Registered User.
Local time
Today, 19:55
Joined
Apr 30, 2003
Messages
3,202
Behind the Report: -
Code:
Option Explicit
Option Compare Text


Private Sub Detail_Format(ByRef intCancel As Integer, _
                          ByRef intFormatCount As Integer)
                          
    [color=green]'   If overdue exceeds $2000.00, highlight the control[/color]
    If Me.txtTotalOverdue > 2000 Then
        [color=green]'  Draw red ellipse around Me.txtTotalOverdue[/color]
        HighlightControl Me.txtTotalOverdue, vbRed, 0.35
    End If

End Sub

In a standard module: -
Code:
Option Explicit
Option Compare Text


Public Sub HighlightControl(ByRef ctlControl As Control, _
                            ByVal lngColour As Long, _
                            ByVal sngAspect As Single)
    
    With ctlControl
        [color=green]'   Remove the current border.[/color]
        .BorderStyle = 0
        
        [color=green]'   Draw the ellipse relative to the control.[/color]
        .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.
 
Last edited:
Status
Not open for further replies.

Users who are viewing this thread

Top Bottom