View Full Version : Report: Limiting results based on criteria


tom453
03-03-2004, 12:08 AM
Hi

I have a database that stores boxes (tblBox), and documents (tblDocs). Now each box holds a number of documents. And each document has a used-by-date.

I need to generate a report that only lists boxes where ALL the documents in that box have passed their used-by-date (based on the current date, eg. today). So the box can be destroyed.

Thanks in Advance
tom

neileg
03-03-2004, 06:25 AM
Create a select query on tblDocs. Add a criterion to the used-by-date >Date(). This will produce a list of all docs that are not past their date.

Create another query that joins tblBox and the first query with a left join (so that all records from tblBox are displayed). Add a criterion of Is Null to one of the fields from the tblDocs query (Document ID or whatever). This will result in a list of Boxes where there is no document that is not past its used-by-date.

Base your report on that.