Thank you, that looks like a good solution, but I guess Northwind wasn't the
best example to use. I don't have enough tables to do the WHERE and Not IN
function. And perhaps I should have mentioned I'm using a form with combo
boxes to select all criteria. My first combo box selects customers with
category, then the next combo box is to select the "productid" - Actually,
I'm looking for customers who have not received certain promotional items.
So instead of having a Orders table and a Order Detail table, I have a
PromoHistory table that contains PromoID, CustomerID and MailingDate. My
combo box shows the PromoID and Promo Description from PromoDescription
table. My query looks like this:
SELECT qryOption1.*, PromoHistory.PromoID
FROM qryOption1 LEFT JOIN PromoHistory ON qryOption1.CustomerID =
PromoHistory.CustomerID
WHERE (((PromoHistory.PromoID) Not Like
Forms!SelectContactsDialog!PromoComboBox
If a H Smith has records for promo1 and promo2 in the PromoHistory table,
when I ask to see customers who have not received promo2, I still get H
Smith, because promo1 meets the criteria. Am I making this harder than it
is?
Thanks
Ofer said:
Try
SELECT Customers.*
FROM Customers
WHERE (((Customers.CustomerID) Not In (SELECT Orders.CustomerID
FROM Orders INNER JOIN [Order Details] ON Orders.OrderID = [Order
Details].OrderID
WHERE [Order Details].ProductID=[Please enter product Id])))
--
\\// Live Long and Prosper \\//
BS"D
mojo said:
Using the Northwind Database as an example, I want to run a query to show
customers who have no related record in the orders detail file for a selected
product. The customers do have order detail for other products, but I want
to see who has not ordered a specific product. I'm running Access 2003.
Thanks for your help.