Results 1 to 4 of 4
  1. #1
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591

    Conditionally format detail section base on a contol value

    I have a report that will show three samples per page in the detail section. One sample has a value of False in a check box field. I have dropped this field into the detail section. I want that row to be highlighted (green in this case) while the other two remain white. This is the code I am using.

    Code:
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
        If [My_Control] = 0 Then Me.Detail.BackColor = RGB(183, 233, 169)
    End Sub
    When I preview the report, all rows are highlighted. I just watched the code run and it looped through the code at least 10 times, I think. I was expecting to run just 3 times.

    Anyway, it does work and I'm not sure why.
    Last edited by Paul H; 03-12-2012 at 01:18 PM.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    It does or does not work? I'd expect an Else clause to handle the other color.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    Sorry, does NOT work.

    I thought if it was false it would leave the color as it was specified in design mode.

    Of course, your suggestion DID work.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Columns in Report Detail Section only
    By gg80 in forum Reports
    Replies: 10
    Last Post: 08-03-2014, 07:41 PM
  2. Count in detail section of a report
    By ccordner in forum Reports
    Replies: 9
    Last Post: 02-08-2012, 06:55 AM
  3. The length of detail section of a report
    By blueraincoat in forum Reports
    Replies: 2
    Last Post: 04-06-2011, 12:24 AM
  4. Conditionally hide detail row in report
    By martinjamesward in forum Reports
    Replies: 5
    Last Post: 09-06-2010, 02:51 AM
  5. Replies: 1
    Last Post: 10-11-2009, 08:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums