Results 1 to 8 of 8
  1. #1
    Join Date
    May 2003
    Location
    UK
    Posts
    233

    Unanswered: Hightlight blank fields in a report

    I have a report with continuous records rolling in the details section of the report. There could be
    many records appearing in the report. There are 13 fields in the detail section. The idea behind the report
    is to highlight when a field has not been populated. So Is Null or, in some cases, the default "Not Selected"
    I want these field to have a different back colour.

    The problem I have is if I put a condition in the field and the first record meets this criteria it will
    set the outcome of the criteria to all records in that field.

    How do I overcome?
    Thanks

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    It should be something like this:

    Code:
    Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    
        If IsNull(Me.<Control>) Then
            Me.<Control>.BackColor = 255         ' Red
        Else
            Me.<Control>.BackColor = 16777215 ' White
        End If
        
    End Sub
    Have a nice day!

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Just btw, vbRed can be used in place of 255, and vbWhite can be used in place of 16777215. Makes it a lot easier to read later
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    thats a new one on me, mind you Im not a fan of the reports inbuilt conditional formatting (its usually too limited for what I want to do), I thought it worked on individual controls.
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14

    Wink

    Thanks StarTrekker !

    I kind of knew that already (did not think of it, though), but I just picked up that sample from an old Access 2 application and pasted it in my reply without giving it a second thought. I'll try to re-read my posts more carefully before sending them in the future.

    Have a nice day!

  6. #6
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    There aren't enough inbuilt constants like vbGreen and vbTuesday for my liking! I love the thingz
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  7. #7
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by StarTrekker
    There aren't enough inbuilt constants like vbGreen and vbTuesday for my liking! I love the thingz
    you could if you so wish create your own list of constants if that would make you happier

    you could extend the vbColour constants
    vbPuce = blah
    vbVomitGreen = bleuh

    I dunno, for a NZDS I'd happily create a series of constants such as
    vbOneOClockAM = 1
    vbTwoOClockAM = 2
    ...
    vbTwelveOClockPM = 24


    obvioulsy you wouldn't neccesarily want to use the vb prefix though
    I'd rather be riding on the Tiger 800 or the Norton

  8. #8
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I'm not sure if the field you're referring to is bound or unbound to an actual field in the table/query. You'll have problems with changing the backcolor/conditional formatting on unbound fields. For these cases, I'll have the expression in the actual underlying query and then "bound" that field on the report.
    Last edited by pkstormy; 04-03-09 at 15:29.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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