This is very easy to do in a report, not so easy to do in a query.
Consider creating a report based on the query, and building a running sum in the report. The Help files will point you in the right direction.
There is a way to do it via code -- see this link -- but it can be a bit buggy.
An alternative might be to write out the data to a dummy table, and base the chart on that (this would involve code to create the records, possibly like this) : or to pull the data into Excel, create the running sum there, and chart it using Excel's charting tools which are much easier to use.
The running sum query is a simple variant on an auto number query where the query or recordset includes a sub-query as a field to calculate the running sum. As with an auto number query, to create a running sum requires that your query have at least one field which has a unique value for each row.
The running sum simply uses the sub-query to sum all the values in rows where the unique field value is are less than or equal to the value of the current field. Here's an example:
RunningSum: (Select Sum (OrderTotal) FROM [Orders] as Temp
WHERE [Temp].[OrderID] <= [Orders].[OrderID])
If you are getting a syntax error, and we have no idea what your code looks like, it is extreamly difficult to help without seeing the SQL for the query you are running. If you post the SQL along with "I'm getting a syntax error", we would have something to go on to help.