I'm not certain of whether I should post in here or in the queries forum. I decided to post here because this error ONLY appears when I try to view the report; the underlying queries work just fine.
The report is meant to show the proportions of ethnicities for each county.
I have a base query like so:
Then a second query draws from the results:
This makes use of a third tiny query to aid in calculating the percentage (I only split this out to see if it would fix the error):
Then, finally, I make a report based on the second query (EthnicityReportQuery). It's supposed to show the county, ethnicity and percentage. This works just fine- until I try to group it by county. As soon as I add that grouping level, whenever I view the report I get the "Multi-level GROUP BY clause is not allowed in a subquery" error. Any ideas? This especially seems strange as I made another report and set of queries very similar (although ti didn't include the percentage or the DISTINCT keyword) which worked just fine.
The report is meant to show the proportions of ethnicities for each county.
I have a base query like so:
Code:
SELECT DISTINCT Zip.Cou_ID, County.Cou_Name, Person.Per_SSN, Ethnicity.Eth_Name
FROM State INNER JOIN (Ethnicity INNER JOIN (County INNER JOIN ((Person INNER JOIN (Household INNER JOIN Zip ON Household.Zip_Code = Zip.Zip_Code) ON (Household.Hou_ID = Person.Hou_ID) AND (Person.Per_SSN = Household.Hou_Per_SSN)) INNER JOIN [Case] ON Household.Hou_ID = Case.Hou_ID) ON County.Cou_ID = Zip.Cou_ID) ON Ethnicity.Eth_Name = Household.Eth_Name) ON State.Sta_Abbrv = Zip.Sta_Abbrv
WHERE (((Zip.Cou_ID) In (SELECT * FROM CountyReportFilter)) AND ((Case.Cas_Date)>=DateValue([Forms]![ReportLauncher]![StartDate].[Value]) And (Case.Cas_Date)<=DateValue([Forms]![ReportLauncher]![EndDate].[Value])));
Then a second query draws from the results:
Code:
SELECT EthnicityQuery.Cou_ID, EthnicityQuery.Cou_Name, EthnicityQuery.Eth_Name, Count(Per_SSN)/(SELECT Eth_Count FROM EthnicityCountQuery) AS Percentage
FROM EthnicityQuery
GROUP BY EthnicityQuery.Cou_ID, EthnicityQuery.Cou_Name, EthnicityQuery.Eth_Name;
This makes use of a third tiny query to aid in calculating the percentage (I only split this out to see if it would fix the error):
Code:
SELECT Count(Per_SSN) AS Eth_Count
FROM EthnicityQuery;
Then, finally, I make a report based on the second query (EthnicityReportQuery). It's supposed to show the county, ethnicity and percentage. This works just fine- until I try to group it by county. As soon as I add that grouping level, whenever I view the report I get the "Multi-level GROUP BY clause is not allowed in a subquery" error. Any ideas? This especially seems strange as I made another report and set of queries very similar (although ti didn't include the percentage or the DISTINCT keyword) which worked just fine.