MSAccess query barchart color

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • baba
    New Member
    • Nov 2011
    • 16

    #1

    MSAccess query barchart color

    SELECT TrendRemedytbl.[Job Name], Count(*) AS [Count]
    FROM TrendRemedytbl
    GROUP BY TrendRemedytbl.[Job Name];


    This query generates a barchart with jobname in xaxis and counts in yaxis .
    Can i also get the color of bar populated CORRECTLY based on if conditions within the query

    I want something like what I have pasted below but the syntax is incorrect. Please help ...


    SELECT iif TrendRemedytbl.[Job Name] = "A" THEN TrendRemedytbl.[Job Name] AS RED,iif TrendRemedytbl.[Job Name] = "B" THEN TrendRemedytbl.[Job Name] AS BLUE,iif TrendRemedytbl.[Job Name] = "C" THEN TrendRemedytbl.[Job Name] AS GREEN, Count(*) AS [Count]
    FROM TrendRemedytbl
    GROUP BY TrendRemedytbl.[Job Name];
  • dsatino
    Contributor
    • May 2010
    • 393

    #2
    I think you want this:
    Code:
    SELECT Switch(TrendRemedytbl.[Job Name] = "A","Red",TrendRemedytbl.[Job Name] = "B","Blue",TrendRemedytbl.[Job Name] = "C","Green") As Job,Count(*) AS [Count]
    FROM TrendRemedytbl
    GROUP BY Switch(TrendRemedytbl.[Job Name] = "A","Red",TrendRemedytbl.[Job Name] = "B","Blue",TrendRemedytbl.[Job Name] = "C","Green")

    Comment

    Working...