Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004

    Unanswered: Highlight null values in report

    Is there a way to highlight a null value in a report?

    I created a report off a query to show records that are incomplete.
    For example: Name, Address, Eyecolor, Hair Color, Race, Gender

    It pulled up about 1200 records that are incomplete.
    I would like to highlight the fields that are null.
    For example: Someone entered a record and neglected to enter the Eye Color.
    This way it might be easier to easily detect the missing data on the report.
    Can this be done with code?

    Thanks in advance!!

  2. #2
    Join Date
    Mar 2003
    The Bottom of The Barrel
    Provided Answers: 1
    check out "conditional formatting"

    You can also programmitcally define formatting in the On Print event of the section.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Nov 2003
    By placing code into the OnFormat event of the section (usually the Details section) which contains the Control or Controls you what to color that are Null, you can....

    be field specific with something like:
    If IsNull(Me.myReportControlName) Then
    'In case the Controls' BackStyle is set to Transparent
    'we set it to Normal
    Me.myReportControlName.BackStyle = 1
    'If the field is Null then change the BackColor to Red
    'and the Font color White.
    Me.myReportControlName.BackColor = vbRed
    Me.myReportControlName.FontColor = vbWhite
    'If the field is Not Null then make the BackColor White
    'And The Font Color Black.
    Me.myReportControlName.BackColor = vbWhite
    Me.myReportControlName.FontColor = vbBlack
    End If
    Or do it globally with:
    Dim Ctrl As Control
    On Error Resume Next
    For Each Ctrl In Me.Controls
    If IsNull(Ctrl) Then
    	 Ctrl.BackStyle = 1
    	 Ctrl.BackColor = vbRed
    	 Ctrl.FontColor = vbWhite
    	 Ctrl.BackColor = vbWhite
    	 Ctrl.FontColor = vbBlack
    End If
    Next Ctrl

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts