Conditional formatting question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ConfusedMay
    New Member
    • Apr 2007
    • 57

    Conditional formatting question

    Hi,

    I have a quick question. Is there an option for conditional formatting in access 97? or is it only for access 2000 or higher? I need to change font color in access 97 report depending on the value. Thank you
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by ConfusedMay
    Hi,

    I have a quick question. Is there an option for conditional formatting in access 97? or is it only for access 2000 or higher? I need to change font color in access 97 report depending on the value. Thank you
    Condiotional Formatting is not built in with Access 97. You would have to resort to VBA code instead.

    Comment

    • puppydogbuddy
      Recognized Expert Top Contributor
      • May 2007
      • 1923

      #3
      Here is an example of what the VBA code might look like. The background color property was used for illustrative purposes., If you wanted to change the font color, you would change the foreground color (ForeColor) property.

      Code:
      Private Sub Quantity_AfterUpdate()
      Select Case CInt(Me.Quantity)
              Case 0 To 10
                  Me.Quantity.BackColor = _
                      RGB(150, 150, 200)
              Case 11 To 40
                  Me.Quantity.BackColor = _
                      RGB(75, 75, 200)
              Case 41 To 160
                  Me.Quantity.BackColor = _
                      RGB(0, 0, 255)
              Case Else
                  Me.Quantity.BackColor = _
                      RGB(200, 0, 0)
          End Select
      End Sub

      Comment

      • ConfusedMay
        New Member
        • Apr 2007
        • 57

        #4
        Originally posted by puppydogbuddy
        Here is an example of what the VBA code might look like. The background color property was used for illustrative purposes., If you wanted to change the font color, you would change the foreground color (ForeColor) property.

        Code:
        Private Sub Quantity_AfterUpdate()
        Select Case CInt(Me.Quantity)
                Case 0 To 10
                    Me.Quantity.BackColor = _
                        RGB(150, 150, 200)
                Case 11 To 40
                    Me.Quantity.BackColor = _
                        RGB(75, 75, 200)
                Case 41 To 160
                    Me.Quantity.BackColor = _
                        RGB(0, 0, 255)
                Case Else
                    Me.Quantity.BackColor = _
                        RGB(200, 0, 0)
            End Select
        End Sub

        Thank you very much....

        Comment

        Working...