Below is the SQL String for both queries. I get the error when I run
qryCustomerSalesSummary2006 when I have the "HAVING ((
(qryCustomerSalesNumbers.SHIPDATE)>#12/31/2005#));" If I remove this it
runs
with no errors.
qryCustomerNumbers:
SELECT qryOEORD_All.ORDER_STATUS, qryOEORD_All.ORDER_NUM, qryOEORD_All.
CUSTOMER_ID, qryOEORD_All.BILL_NAME, qryOEORD_All.SALESPERSON,
qryOEORD_All.
ORDER_DATE, qryOEORD_All.COMPANY, qryOEORD_All.DEPOSIT AS DEP_AMT,
qryOEORD_All.FREIGHT AS FRT_AMT, qryOEORD_All.TOTAL_TAX_AMT AS TAX_AMT,
qryOEORD_All.SHIP_QTY_DETAIL_TOT AS SALE_AMT,
qryOEORD_All.SHIP_QTY_ORDER_TOT
AS INV_AMT,
IIf(IsNull([SHIP_DATE]),Null,DateSerial(Left([SHIP_DATE],2),Mid(
[SHIP_DATE],3,2),Right([SHIP_DATE],2))) AS SHIPDATE
FROM qryOEORD_All
WHERE (((qryOEORD_All.ORDER_STATUS)="P"));
qryCustomerSalesSummary2006:
SELECT qryCustomerSalesNumbers.CUSTOMER_ID,
qryCustomerSalesNumbers.BILL_NAME,
Sum(qryCustomerSalesNumbers.SALE_AMT) AS SumOfEXT_PRICE,
qryCustomerSalesNumbers.COMPANY
FROM qryCustomerSalesNumbers
GROUP BY qryCustomerSalesNumbers.CUSTOMER_ID, qryCustomerSalesNumbers.
BILL_NAME, qryCustomerSalesNumbers.COMPANY,
qryCustomerSalesNumbers.SHIPDATE
HAVING (((qryCustomerSalesNumbers.SHIPDATE)>#12/31/2005#));
It is like that the error is caused by non-total Field(s) in the SELECT
clause but not in the GROUP BY clause. If you can't find what's wrong,
post
relevant Table details and the SQL String of your Query.
With your posted expression, you need to ensure that your data don't
include
20th century date. You can take advantage of the default century settings
in your Windows OS in DateSerial(). Personally, I use:
=IIf(IsNull([yymmdd]), Null,
DateSerial(Left([yymmdd],2), Mid([yymmdd],3,2), Right([yymmdd],2)))
I have a fld that contains the date as text. I have using the below
statment
[quoted text clipped - 8 lines]