F
Fred Newtz
I am trying to convert a query that did not get converted with the Upsizing
Wizard.
The query needs to return a record only if the primary key is not in another
related table. So basically I am trying to show all of the orders that are
in place that have not been invoiced yet. So I need to be able to check the
tblInvoices table and see if the OrderID is not in there. Here is the
current query in Access.
SELECT JobClass.Item, Orders.JobClass, Orders.Priority, Orders.OrderID,
Orders.CustomerID, Customers.CompanyName, Orders.EntryDate, Orders.RcvdDate,
Quotes.QuoteDate, Orders.RequiredDate, Orders.ShippedDate,
Orders.WIPDescription, Orders.OrderDate, Orders.InvoiceCreated,
tblInvoices.OrderID, Orders.Payment, IIf(DCount("[Quantity]","Order
Details","OrderID = '" & [Orders].[OrderID] &
"'")<>0,CCur((DSum("[Quantity]*[UnitPrice]","Order Details","OrderID = '" &
[Orders].[OrderID] & "'"))-[Orders.Payment]),CCur("0")) AS OrderAmount
FROM Customers INNER JOIN (((Orders LEFT JOIN Quotes ON Orders.OrderID =
Quotes.OrderID) INNER JOIN JobClass ON Orders.JobClass = JobClass.JobClass)
LEFT JOIN tblInvoices ON Orders.OrderID = tblInvoices.OrderID) ON
Customers.CustomerID = Orders.CustomerID
WHERE (((Orders.JobClass)<>"SERVICE JOBS - TO EVALUATE" And
(Orders.JobClass)<>"SERVICE JOBS - WAITING ON CUST" And
(Orders.JobClass)<>"SERVICE JOBS - COMPANY EQUIPMENT NOT SOLD" And
(Orders.JobClass)<>"TRACEABILITY ORDER") AND ((Orders.InvoiceCreated)=False)
AND ((tblInvoices.OrderID) Is Null)) - This last statement is what is
giving me headaches.
ORDER BY JobClass.Item, Orders.Priority;
Anyone have any ideas or what I should search for even.
Thanks,
Fred
Wizard.
The query needs to return a record only if the primary key is not in another
related table. So basically I am trying to show all of the orders that are
in place that have not been invoiced yet. So I need to be able to check the
tblInvoices table and see if the OrderID is not in there. Here is the
current query in Access.
SELECT JobClass.Item, Orders.JobClass, Orders.Priority, Orders.OrderID,
Orders.CustomerID, Customers.CompanyName, Orders.EntryDate, Orders.RcvdDate,
Quotes.QuoteDate, Orders.RequiredDate, Orders.ShippedDate,
Orders.WIPDescription, Orders.OrderDate, Orders.InvoiceCreated,
tblInvoices.OrderID, Orders.Payment, IIf(DCount("[Quantity]","Order
Details","OrderID = '" & [Orders].[OrderID] &
"'")<>0,CCur((DSum("[Quantity]*[UnitPrice]","Order Details","OrderID = '" &
[Orders].[OrderID] & "'"))-[Orders.Payment]),CCur("0")) AS OrderAmount
FROM Customers INNER JOIN (((Orders LEFT JOIN Quotes ON Orders.OrderID =
Quotes.OrderID) INNER JOIN JobClass ON Orders.JobClass = JobClass.JobClass)
LEFT JOIN tblInvoices ON Orders.OrderID = tblInvoices.OrderID) ON
Customers.CustomerID = Orders.CustomerID
WHERE (((Orders.JobClass)<>"SERVICE JOBS - TO EVALUATE" And
(Orders.JobClass)<>"SERVICE JOBS - WAITING ON CUST" And
(Orders.JobClass)<>"SERVICE JOBS - COMPANY EQUIPMENT NOT SOLD" And
(Orders.JobClass)<>"TRACEABILITY ORDER") AND ((Orders.InvoiceCreated)=False)
AND ((tblInvoices.OrderID) Is Null)) - This last statement is what is
giving me headaches.
ORDER BY JobClass.Item, Orders.Priority;
Anyone have any ideas or what I should search for even.
Thanks,
Fred