Conditional Formatting Colors and Code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ApexData@gmail.com

    Conditional Formatting Colors and Code

    In a Continuous form, I want to use Conditional Formatting to change
    the background color of a date field based on a condition.

    1-The color chart in the CF menu option offers limited colors. How can
    I use the custom colors I need ???

    2-Is Conditional Formatting available in code, so that I can use more
    than 3-conditions and have more versatility than the Access2k CF menu
    option offers ???

    Thanks Greg

  • Tom van Stiphout

    #2
    Re: Conditional Formatting Colors and Code

    On 3 Mar 2007 13:59:40 -0800, "ApexData@gmail .com"
    <ApexData@gmail .comwrote:

    Re: 1: Too bad, so sad. But read Re: 2

    Re: 2: Sure: you can create a single condition with "Expression Is",
    and then as the expression you can specify your own function, which
    would test all (more than 3) conditions you need. This must be a
    public function in a standard module, returning a boolean.

    AFAIK, there is no documented way to programmaticall y manipulate the
    conditional formatting, but if you feel adventurous: open the object
    browser (F2) right click Show hidden members then search for
    "condi" (no, not Condi :-)) and you'll find interesting classes like
    FormatCondition and FormatCondition s to be explored.

    -Tom.


    >In a Continuous form, I want to use Conditional Formatting to change
    >the background color of a date field based on a condition.
    >
    >1-The color chart in the CF menu option offers limited colors. How can
    >I use the custom colors I need ???
    >
    >2-Is Conditional Formatting available in code, so that I can use more
    >than 3-conditions and have more versatility than the Access2k CF menu
    >option offers ???
    >
    >Thanks Greg

    Comment

    • ApexData@gmail.com

      #3
      Re: Conditional Formatting Colors and Code

      Thankyou Tom

      I experimented with the "Expression Is" option, and was able to
      satisfy my condition issues.

      However, I really need to be able to set the background color of a
      field meeting the condition, to colors not showing on the grossly
      limited color chart. There must be a way???

      Thanks Greg

      Comment

      • ApexData@gmail.com

        #4
        Re: Conditional Formatting Colors and Code

        I believe I figured it out.

        Me.txtMyTextBox .FormatConditio ns(0).BackColor = RGB(64, 128, 196)

        I would use this expression in code in the LoadForm event to establish
        my choice of color for the first Conditional Formatting result. And
        follow this method for the others.

        Greg

        Comment

        • Marshall Barton

          #5
          Re: Conditional Formatting Colors and Code

          ApexData@gmail. com wrote:
          >In a Continuous form, I want to use Conditional Formatting to change
          >the background color of a date field based on a condition.
          >
          >1-The color chart in the CF menu option offers limited colors. How can
          >I use the custom colors I need ???

          You can use colors other than what the palette offers by
          using the FormatCondition s "collection ".

          Private Sub Form_Open(Cance l As Integer)

          Me.txtID.Format Conditions(0).B ackColor = RGB(255,240,240 )
          Me.txtID.Format Conditions(1).B ackColor = RGB(240,255,240 )
          Me.txtID.Format Conditions(2).B ackColor = RGB(240,240,255 )

          End Sub

          Regardless of what you do, a single control can only have
          the default color plus three conditional colors. If you
          need to go to extremes, you can play games by stacking text
          boxes on top of each other and get another three colors for
          each text box.

          --
          Marsh

          Comment

          Working...