platypusfeet
New member
- Local time
- Yesterday, 23:40
- Joined
- Nov 14, 2018
- Messages
- 8
I am trying to add charts to a report in Access 2016. The chart will be based on data sums and is placed in the report header.
My report is shows all of the "item" entries for a specific asset (which is selected through query via a combo box form upon open). One of the fields in the item table is risk level. Risks can be either 1, 2, or 3.
I know that I can display the total number of items using =Count(*) and I have text boxes that show the number of items with each risk level as =Count(IIf([RiskLevelID]=#,0)) where # is 1, 2, or 3 (I have one box for each).
I have also created a query that I can use to group items (the entries in tblRISKS) by AssetID into the categories by risk level. The SQL for the query is:
SELECT tblRISKS.AssetID, Count(IIf([RiskLevelID]=1,0)) AS CountLow, Count(IIf([RiskLevelID]=2,0)) AS CountMedium, Count(IIf([RiskLevelID]=3,0)) AS CountHigh
FROM tblRISKS
GROUP BY tblRISKS.AssetID;
I can create a chart using this query in a blank form and it works exactly as expected (sorting items by asset then showing how many fall into each risk level category).
I want to create an equivalent chart in my report that displays CountLow, CountMedium, and CountHigh for the asset that the report is about. Ideally this would be a pie chart.
I've gone through the chart wizard a few times using different variations of the query above, but it doesn't work. I am assuming the error is in the SELECT statement, but I am not sure how to correctly specify the SELECT statement that I need.
The report is based on a query that pulls from a number of tables (including tblRISKS). The input to the query is tblRISKS.AssetID (which, as mentioned, must be specified upon opening the report). I also have the AssetID on my report in a text box named "BoxAssetID".
I couldn't figure out if I could just semi-manually enter the data for the chart (for example by manually typing the Count(IIf()) statements into the chart datasheet or by setting the datasheet values equal to the Count(IIf()) boxes that are already on my form) as a way to avoid the chart wizard, but I had no luck.
I've been at it for a couple hours now and I feel like I'm missing something basic, but I've been having just no luck. Any advice would be greatly appreciated!
My report is shows all of the "item" entries for a specific asset (which is selected through query via a combo box form upon open). One of the fields in the item table is risk level. Risks can be either 1, 2, or 3.
I know that I can display the total number of items using =Count(*) and I have text boxes that show the number of items with each risk level as =Count(IIf([RiskLevelID]=#,0)) where # is 1, 2, or 3 (I have one box for each).
I have also created a query that I can use to group items (the entries in tblRISKS) by AssetID into the categories by risk level. The SQL for the query is:
SELECT tblRISKS.AssetID, Count(IIf([RiskLevelID]=1,0)) AS CountLow, Count(IIf([RiskLevelID]=2,0)) AS CountMedium, Count(IIf([RiskLevelID]=3,0)) AS CountHigh
FROM tblRISKS
GROUP BY tblRISKS.AssetID;
I can create a chart using this query in a blank form and it works exactly as expected (sorting items by asset then showing how many fall into each risk level category).
I want to create an equivalent chart in my report that displays CountLow, CountMedium, and CountHigh for the asset that the report is about. Ideally this would be a pie chart.
I've gone through the chart wizard a few times using different variations of the query above, but it doesn't work. I am assuming the error is in the SELECT statement, but I am not sure how to correctly specify the SELECT statement that I need.
The report is based on a query that pulls from a number of tables (including tblRISKS). The input to the query is tblRISKS.AssetID (which, as mentioned, must be specified upon opening the report). I also have the AssetID on my report in a text box named "BoxAssetID".
I couldn't figure out if I could just semi-manually enter the data for the chart (for example by manually typing the Count(IIf()) statements into the chart datasheet or by setting the datasheet values equal to the Count(IIf()) boxes that are already on my form) as a way to avoid the chart wizard, but I had no luck.
I've been at it for a couple hours now and I feel like I'm missing something basic, but I've been having just no luck. Any advice would be greatly appreciated!