
Originally Posted by
June7
Yes, removing the year filter from the bar chart RowSource was appropriate. I just used it to show a simple graph. I should have suggested trying without it.
Try this for line chart:
Build and save this query: MovementUNION
SELECT AirportID, Year, "MDATotal" AS Source, AirMovementMDATotal AS Data FROM YearT RIGHT JOIN AircraftMovementT ON YearT.YearID = AircraftMovementT.YearID
UNION SELECT AirportID, Year, "RegTotal", AirMovementRegionalTotal FROM YearT RIGHT JOIN AircraftMovementT ON YearT.YearID = AircraftMovementT.YearID
UNION SELECT AirportID, Year, "IntlTotal", AirMovementIntlTotal FROM YearT RIGHT JOIN AircraftMovementT ON YearT.YearID = AircraftMovementT.YearID;
That is a UNION query and must type or copy/paste in SQL View of query builder. This is essentially normalizing the data structure.
RowSource for the line chart:
TRANSFORM Sum(MovementUNION.Data) AS SumOfData
SELECT MovementUNION.Year
FROM MovementUNION
WHERE (((MovementUNION.AirportID)=1 Or (MovementUNION.AirportID)=2 Or (MovementUNION.AirportID)=3))
GROUP BY MovementUNION.Year
PIVOT AirportID & ": " & Source;
The graph is working. But now I want the WHERE clause to be arbitrary by using 3 comboboxes. So I put under criteria in querybuilder under AirportID a WHERE clause with [cboAirport] Or [cboAirport2] Or [cboAirport3]
This gives me the following error:
[cboAirport]:
Code:
SELECT DISTINCT [AirportT].[AirportID], [AirportT].[Airport] FROM AirportT ORDER BY [Airport];
RowSource:
Code:
TRANSFORM Sum(MovementUNION.Data) AS SumOfData SELECT MovementUNION.Year FROM MovementUNION WHERE (((MovementUNION.AirportID)=[cboAirport] Or (MovementUNION.AirportID)=[cboAirport2] Or (MovementUNION.AirportID)=[cboAirport3])) GROUP BY MovementUNION.Year, MovementUNION.AirportID PIVOT AirportID & ": " & Source;