Access Report Outcomes Are Different Colours Depending On The Outcome

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nicholas Davenport
    New Member
    • Aug 2010
    • 18

    #1

    Access Report Outcomes Are Different Colours Depending On The Outcome

    Hi I hope someone can help as i'm quite new to access

    I have created a report that calculates the time between two fields that has a outcome field of the time difference between the two original fields.

    Example:

    Field 1: SaveTime 14.13 Field 2: CallTime 15.18 Field 3 TATime 01.05.13(65 Minutes).

    The TATime is the difference between fields 1 & 2. I would like to run my report so that when the TATime is greater that 00:59:59 the outcomes turn to red otherwise the outcomes stay green.

    I have tried the following code so far and doesn't seem to work:

    If Me![TATime] < ="00:59:59" Then
    Me![TATime] = vbRed
    Else
    Me![TATime] = vbGreen
    EndIf
    EndSub


    Any help would be greatly appreciated

    Cheers
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    #2
    When you don't specify what property you are setting, the default is to set the value property. In this case:
    Code:
    me!TATime=vbRed
    is equal to trying to set the TATime field equal to the vbRed constant.

    What your looking for would be:
    Code:
    me.TATime.ForeColor=vbRed
    You also have to place the code the correct place, my suggestion would likely be the Detail_Format event.

    Comment

    • Megalog
      Recognized Expert Contributor
      • Sep 2007
      • 378

      #3
      You can also easily accomplish this with conditional formatting, assuming you dont have too many different criteria/colors to assign. Look for the 'Conditional' button under the Font Group, in the 'Format' tab.

      Comment

      Working...