THE TLDR: I have three fields, FCP, COST, and STATUS. I need to know the subquery expression to display SUM of COST where STATUS = "Budget"
Long Version
I'm trying to create a fiscal dashboard (despite having no Access, SQL, or programming training) and I'm quite stuck in getting the fields to propertly interact.
For simplification, let's say I have three fields
FCP : Fund control point, where the money is coming from. It's a list of numbers.
Cost: How much was spent
Status (Budget, Spent, Obligated, or Planned)
What I tried and failed: Created a form where the data source is a list of FCP. I made a query for the relevant field (Select FCP and sum of cost where status=budget) and put that into a subform, and have a text box siaplay the output of that query in a subform. This worked, BUT... this can only display one fund control point at a time, as subforms can't be in a continuous form. My plan (before learning of this stupid restriction) was to make a subform for each of the relevant queries (One for each Status type), put them in a row, and let the continuous form display all the fund control points. This isn't going to work.
I also tried how I thought "Query by form" would work. I created a continuous form of the fund control points, and set a query to pull data where the fund control point equaled the fund control point field on the continuous form. The result was that it would pull the correct data, but ONLY for the first field, and display that same data for all subsequent fields. So if the first listed FCP was 30, it would display that field's data in the entire column of outputs.
As I understand it, what I need to do is a subquery, such as demonstated at https://msdn.microsoft.com/en-us/lib...ffice.11).aspx . In this way my data source would have all of the relevant information. As I understand it, I am cramming an entire query into a single field of a larger query.
So as I understand it, I need to create a query, activate "totals", and the first column is FCP with "Group by." Then I need to create the subqueries in the other columns for each status. So it would be something like this
First Column: FCP (Group by)
Second Column: BudgetEntry: (SELECT Sum(Cost) FROM TFiscalData WHERE Status = "BUDGET") (Expression)
This results in the same thing as when I trid Query by Form, with all of the results being the result for the first displayed field. What I think is happening is that the expression needs some sort of "Where FCP equals" but I don't know where to go from here. As I understand it, that the query is already grouped by FCP means that shouldn't be a part of the query.
I want this query to spit back the sum of COST where STATUS equals "Budget", sorted by FCP. Please help.