I have a chart based on a crosstab query of SectionName versus Status where Status is Open, Ready for Closure, or Closed. The problem is that when there are no SectionNames at status Ready for Closure, I get errors and my chart is blank. I understand the problem but I'm not a programmer and don't know how to fix it. It seems like an IIF statement around the Row Source SELECT phrase "Sum(ctbStatusBySection.[Ready for Closure]) AS [Ready for Closure]" would fix it, but I don't know the correct syntax.
Here is the SQL Code from the crosstab query:
TRANSFORM Count(qryAllTPRsWithoutReplacedPartsData.prob_stat us_text) AS [Count]
SELECT qryAllTPRsWithoutReplacedPartsData.SectionName, Count(qryAllTPRsWithoutReplacedPartsData.prob_stat us) AS Total
FROM qryAllTPRsWithoutReplacedPartsData
GROUP BY qryAllTPRsWithoutReplacedPartsData.SectionName
ORDER BY qryAllTPRsWithoutReplacedPartsData.SectionName
PIVOT qryAllTPRsWithoutReplacedPartsData.prob_status_tex t;
Here is the Row Source from the chart:
SELECT ctbStatusBySection.SectionName, Sum(ctbStatusBySection.Open) AS Open, Sum(ctbStatusBySection.[Ready for Closure]) AS [Ready for Closure], Sum(ctbStatusBySection.Closed) AS Closed FROM ctbStatusBySection GROUP BY ctbStatusBySection.SectionName ORDER BY Sum(ctbStatusBySection.Open) DESC , Sum(ctbStatusBySection.[Ready for Closure]) DESC , Sum(ctbStatusBySection.Closed) DESC;