I have a query that takes inputs from a form (AgencyID, ServiceGroup, BillingPeriod). BillingPeriod has a start variable and an end variable selected on the form. I would like sum the Quantity if it meets all other criteria (falls within the date range). The query below is what I have gotten to. It only gives me the output of the first record. Please help.
SELECT AgencyList.AgencyID, AgencyList.Address, AgencyList.ZipCode, ZipCodeT.City, ZipCodeT.State, RateTable.Rate, RateTable.Unit, RateTable.ServiceGroup, PinnacleTable.CLASS_OF_SERVICE, Sum(PinnacleTable.Quantity) AS SumOfQuantity, PinnacleTable.BillingPeriod, AgencyList.AgencyName
FROM ZipCodeT INNER JOIN (ServiceGroupT INNER JOIN (AgencyList INNER JOIN (RateTable INNER JOIN PinnacleTable ON RateTable.ServiceID = PinnacleTable.[CLASS_OF_SERVICE]) ON AgencyList.AgencyID = PinnacleTable.AgencyID) ON ServiceGroupT.ServiceGroup = RateTable.ServiceGroup) ON ZipCodeT.ZipCode = AgencyList.ZipCode
GROUP BY AgencyList.AgencyID, AgencyList.Address, AgencyList.ZipCode, ZipCodeT.City, ZipCodeT.State, RateTable.Rate, RateTable.Unit, RateTable.ServiceGroup, PinnacleTable.CLASS_OF_SERVICE, PinnacleTable.BillingPeriod, AgencyList.AgencyName
HAVING (((AgencyList.AgencyID)=[Forms]![Filter]![Combo4]) AND ((RateTable.ServiceGroup)=[Forms]![Filter]![Combo13]) AND ((PinnacleTable.CLASS_OF_SERVICE)="NYENET") AND ((PinnacleTable.BillingPeriod)>=[Forms]![Filter]![Combo0] And (PinnacleTable.BillingPeriod)<=[Forms]![Filter]![Combo2]));