Access Conditional Formatting Help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • summerlw
    New Member
    • Oct 2008
    • 2

    Access Conditional Formatting Help

    Access 2003
    VB 6.5

    I'm attempted to run conditional formatting on a date field based on the value in another field. I've steped through this code and it is recognizing the values correct and is even executing the code to set the back ground color. However when run the report I don't get any formatting.

    Any help would be appreciated!


    Private Sub Detail_Format(C ancel As Integer, FormatCount As Integer)

    On Error GoTo Detail_Format_E rror


    Select Case [Reports]![pm_original_sco recard_report]![def_doc_health_ cd].Value
    Case Is = "YL"
    [Reports]![pm_original_sco recard_report]![def_doc_act_cmp lt_dt].BackColor = vbYellow
    Case Is = "GN"
    [Reports]![pm_original_sco recard_report]![def_doc_act_cmp lt_dt].BackColor = vbGreen
    Case Is = "BL"
    [Reports]![pm_original_sco recard_report]![def_doc_act_cmp lt_dt].BackColor = vbBlue
    Case Is = "RD"
    [Reports]![pm_original_sco recard_report]![def_doc_act_cmp lt_dt].BackColor = vbRed
    Case Else
    [Reports]![pm_original_sco recard_report]![def_doc_act_cmp lt_dt].BackColor = vbWhite
    End Select



    Detail_Format_E xit:
    Exit Sub

    Detail_Format_E rror:
    MsgBox "Error " & Err.Number & ": " & Err.Description
    Resume Detail_Format_E xit

    End Sub
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    If you are getting the Back Colors, what exactly aren't you getting?

    Comment

    • summerlw
      New Member
      • Oct 2008
      • 2

      #3
      I wasn't getting the back colors even though I stepped through the code and it showed it executing that line.

      However, we can chalk this up to a strange MicroSoft behavior because I just went in and tried the conditional formatting through the GUI. I literally just added one condition and ran the report and everything started working. I then went and removed the conditional formatting via the GUI and just kept the code ... Still works. I didn't change one piece of code ......

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        I've never had trouble using CF thru code, but when using expressions I knew were valid in CF thru the GUI I've had a number of times when it didn't work. Once I gave up to tend to other business, and returning to the form found that it worked just as it should! Since then when this happens I always close the app then re-open it and it always works. The CF appears to "hang." I've noticed that this tends to occur more frequently when I've been experimenting with different CFs on a single textbox. It'll work the first couple of tries and then bomb.

        Welcome to Bytes!

        Linq ;0)>

        Comment

        Working...