How can I control the bar color on a Access 97 graph with VBA?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alex20052003
    New Member
    • Sep 2010
    • 2

    #1

    How can I control the bar color on a Access 97 graph with VBA?

    I have a main form with header information about audits in my work place, and have several sub forms on a Tab control object, one of this sub forms contains a simple bar graph base on the percentage (average) of the audit result.

    The row source of the graph is base on a 3 field query, one named Audit_N (text and unique identifier), PCT (percentage of grade of audit) and Sclass (Type of exam, this field is hidden and it only use to link with header information)

    What I would like to know is, if it's possible to add some VBA code where I can put some validations that if PCT field value is between 1 and 50% make the bar color red, if the PCT is between 51 and 80% make it yellow, if PCT is between 81 and 99% make it green and if it's 100% make it blue. Some example data:

    Audit_N PCT
    0000001 100
    0000002 100
    0000003 50
    0000004 25
    0000005 50
    0000006 75

    Please let me know if you need for information, appreciate help, thanks.
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Code:
    Me![<Chart Name>].SeriesCollection(<Series Number>).Interior.Color = <Color>
    'as in
    Code:
    Me![Graph1].SeriesCollection(2).Interior.Color = vbBlack

    Comment

    • alex20052003
      New Member
      • Sep 2010
      • 2

      #3
      Thanks for quick response, and sorry for my ignorance, but I'm not getting the SeriesCollectio n property from my Graph object, am I missing something?...

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        How, exactly, was your Graph created?

        Comment

        Working...