Query Conflict




I am using MS Office Access 2003 (11.5614). I have been running the
following query with good results. The query lets me enter the month
period and returns the SUM of the age fields.

SELECT [Enter Month/Year as mm/yyyy] AS [Month/Year], SUM([0 to 18])
AS [Sum of 0 to 18], SUM([19 to 40]) AS [Sum of 19 to 40], SUM([41 to
65]) AS [Sum of 41 to 65], SUM([66 Plus]) AS [Sum of 66 Plus]
FROM [Lake Worth CFP Clients]
WHERE FORMAT([SvcDate 1],"mm/yyyy")=[Enter Month/Year as mm/yyyy];

I now want to add an additional criteria of the city field. I added
the criteria with the SQL results
..
SELECT [Enter Month/Year as mm/yyyy] AS [Month/Year], Sum([0 to 18])
AS [Sum of 0 to 18], Sum([19 to 40]) AS [Sum of 19 to 40], Sum([41 to
65]) AS [Sum of 41 to 65], Sum([66 Plus]) AS [Sum of 66 Plus]
FROM [Lake Worth CFP Clients]
WHERE (((Format([SvcDate 1],"mm/yyyy"))=[Enter Month/Year as mm/yyyy])
AND (([Lake Worth CFP Clients].City)="Lake Worth"));

I get the following error message:

You tried to execute a query that does not include the specified
expression "city" as part of an aggregate function.

The conflict appears to be between the city criteria and the SUM of
the ages.

Can anyone give me some direction in this matter ?

.



Relevant Pages

  • RE: Filtering a subform using many combo boxes
    ... SELECT AssignedPriority, AssignedPriorityDetail FROM tblAssignedPriority ... YES for all of the combo boxes.) ... I followed you instructions to the letter and every one of the criteria ... open the query "qryProjects" in design view. ...
    (microsoft.public.access.forms)
  • Re: using a form with combo box to input criteria
    ... Candia Computer Consulting - Candia NH ... When you removed the criteria, ... Then your criteria in the query would be... ... query behind your main report. ...
    (microsoft.public.access.forms)
  • Re: using a form with combo box to input criteria
    ... Candia Computer Consulting - Candia NH ... When you removed the criteria, ... Then your criteria in the query would be... ... query behind your main report. ...
    (microsoft.public.access.forms)
  • RE: Filtering a subform using many combo boxes
    ... I followed you instructions to the letter and every one of the criteria ... I described the typical properties of all my combo boxes in my original ... open the query "qryProjects" in design view. ... I have a main table named tblProjectData that contains all the data for each ...
    (microsoft.public.access.forms)
  • Re: using a form with combo box to input criteria
    ... When you removed the criteria, ... Then your criteria in the query would be... ... query behind your main report. ...
    (microsoft.public.access.forms)

Quantcast