Try changing:

> FROM [orders] AS order1 +
> inner JOIN [customers] ON order1.custid=customers.custid +
> WHERE order1.dateordered BETWEEN strglblbegdate  AND strglblenddate +

To:

FROM [orders] AS order1 +
inner JOIN [customers] ON order1.custid=customers.custid +
WHERE +

>> order1.orderID NOT IN (SELECT OrderID FROM tblSchedule) AND +

order1.dateordered BETWEEN strglblbegdate  AND strglblenddate +

(the new code is on the >> line).  You don't need to add tblSchedule to the
FROM clause of main SELECT statement, and do not put it in the middle of the
INNER JOIN syntax.

You should also know the following about MS Access:

1. It is exceedingly slow with the IN statement if a large number of values are
returned.

2. It will fail if the IN select returns a NULL as one of its values, so you
should always explicitly protect against that possibility.

--
Larry

--
Larry

Reply via email to