K
klr
I have a query that has 4 fields - Officer; Team; Finalcost; Date
completed (charged).
Officer is set to Group By
Team - criteria reads <> "DI"
Cost is set to Sum
The field I am having problems with is the Date charged field - I need
to pull through all records dated previous month. I am using Between
DateSerial(Year(Date()),Month(Date())-1,1) And
DateSerial(Year(Date()),Month(Date()),0) in the criteria field. The
only fields I actually need to display in the query result are Officer
and Total (grouped by Officer).
When I run the query without Date field, the officer totals are
grouped. When I add the Date field, the records from August are
displayed, however the officer grouping is no longer applied.
I am working in Design view of Access as not au fait with SQL however
SQL expression reas as follows:-
SELECT tEnq_main.officer, Sum(tEnq_main.finalcost) AS SumOffinalcost,
tEnq_main.[date completed (charged)]
FROM tEnq_main
GROUP BY tEnq_main.officer, tEnq_main.team, tEnq_main.[date completed
(charged)]
HAVING ((Not (tEnq_main.team)="Data Insight") AND ((tEnq_main.[date
completed (charged)]) Between
DateSerial(Year(Date()),Month(Date())-1,1) And
DateSerial(Year(Date()),Month(Date()),0)));
Can anyone advise on where I am going wrong? Many thanks.
KLR
completed (charged).
Officer is set to Group By
Team - criteria reads <> "DI"
Cost is set to Sum
The field I am having problems with is the Date charged field - I need
to pull through all records dated previous month. I am using Between
DateSerial(Year(Date()),Month(Date())-1,1) And
DateSerial(Year(Date()),Month(Date()),0) in the criteria field. The
only fields I actually need to display in the query result are Officer
and Total (grouped by Officer).
When I run the query without Date field, the officer totals are
grouped. When I add the Date field, the records from August are
displayed, however the officer grouping is no longer applied.
I am working in Design view of Access as not au fait with SQL however
SQL expression reas as follows:-
SELECT tEnq_main.officer, Sum(tEnq_main.finalcost) AS SumOffinalcost,
tEnq_main.[date completed (charged)]
FROM tEnq_main
GROUP BY tEnq_main.officer, tEnq_main.team, tEnq_main.[date completed
(charged)]
HAVING ((Not (tEnq_main.team)="Data Insight") AND ((tEnq_main.[date
completed (charged)]) Between
DateSerial(Year(Date()),Month(Date())-1,1) And
DateSerial(Year(Date()),Month(Date()),0)));
Can anyone advise on where I am going wrong? Many thanks.
KLR