This any better?
SELECT type AS [t], orderid AS [order], order1.custid AS [cust id], + t0 AS [first name], t26 AS [last name], + t11 AS [company], dateordered AS [ordered], datecompleted AS [completed], + salesperson AS [sales rep], paymentterm AS [terms], (SELECT SUM(tprice) + FROM [orderparts] WHERE orderid=order1.orderid) AS [charges], + (SELECT SUM(amount) FROM [payments] WHERE orderid=order1.orderid) + AS [payments], + ([charges] - [payments]) AS [balance] FROM [orders] AS order1 + inner JOIN [customers] ON order1.custid=customers.custid + WHERE order1.dateordered BETWEEN strglblbegdate AND strglblenddate + AND order1.datecompleted IS NOT NULL AND + (((SELECT SUM(tprice) FROM [orderparts] + WHERE orderid = order1.orderid)-(SELECT SUM(amount) + FROM [payments] WHERE orderid = order1.orderid)) > 0) + & strStoneTypeFromCombo & ORDER BY order1.orderid DESC
Now I want to limit the result above to only records that don't exist in another table (tblschedule) by orderid
Jim
At 12:08 PM 9/21/2004, you wrote:
> The syntax will look funny to most as it is VB to an access database, > and no I didn't create it, I just have to work on it.
Jim, could you have VB print out the two SQL statements without the quotes and line continuations, and repost those? It's too hard to read SQL with all the VB stuff interspersed. -- Larry

