Results 1 to 2 of 2
  1. #1
    Join Date
    May 2008
    Posts
    9

    Unanswered: FormatConditions code not working

    The code below does not raise any errrors. However, it also does not work.

    When I set this up within the control's Conditional Formatting it works.

    Any ideas why there may be a difference?

    Code:
    Private Sub Form_Load()
       Dim objFrc As FormatCondition
        Dim lngRed As Long
        Dim lngWhite As Long
        Dim lngBlack As Long
        Dim lngYellow As Long
    
        ' Set up background and foreground colors.
        lngRed = RGB(255, 0, 0)
        lngWhite = RGB(255, 255, 255)
        lngBlack = RGB(0, 0, 0)
        lngYellow = RGB(255, 255, 0)
    
    
        Me![DEV].FormatConditions.Delete
    
        Set objFrc = Me![DEV].FormatConditions.Add(acFieldValue, acEqual, "PI")
        Set objFrc = Me![DEV].FormatConditions.Add(acFieldValue, acEqual, "FI")
        Set objFrc = Me![DEV].FormatConditions.Add(acFieldValue, acEqual, "TI")
    
        With Me![DEV].FormatConditions(0)
            .BackColor = lngYellow
            .FontBold = True
            .ForeColor = lngBlack
        End With
    
        With Me![DEV].FormatConditions(1)
            .BackColor = lngBlack
            .FontBold = True
            .ForeColor = lngRed
        End With
    
        With Me![DEV].FormatConditions(2)
            .BackColor = lngRed
            .FontBold = True
            .ForeColor = lngBlack
        End With
    
    End Sub

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    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

Posting Permissions

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