Dates Older Than (MORE)

D

DS

That Date funtio worked fine except it doesn't do what I thought it
would. I need the Query to return any item [Product] that has not sold
anything in the last 20 Days {SaleDate]. I have the Date part OK now
but I'm still seeing Products that Have sold within the last 20 Days
still in the Query. Any suggestions?
Thanks
DS
 
J

John Vinson

That Date funtio worked fine except it doesn't do what I thought it
would. I need the Query to return any item [Product] that has not sold
anything in the last 20 Days {SaleDate]. I have the Date part OK now
but I'm still seeing Products that Have sold within the last 20 Days
still in the Query. Any suggestions?
Thanks

You'll want an Exists clause in your query:

SELECT <whatever>
FROM [Products]
WHERE NOT EXISTS
(SELECT [Product] FROM [OrderDetails] WHERE SaleDate > DateAdd("d",
-20, Date()) AND [OrderDetails].[Product] = [Products].[Product])


John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Top