Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble trying to filter records in a subReportQuery 1

Status
Not open for further replies.

houstonbill

Technical User
Nov 6, 2006
92
I accidentally put this on the wrong forum (other) and wanted to place this where it belongs.

I am wondering if/how I might filter the records that I need. The SQL below shows a sub-report that aligns the members “ContractNum” and “relcode” with the primary list of members in a report. The field “Compliant” can be Yes, No,NA or Unknown and there are 5 possible categories reported. I want this query print all members that may have a NO or UNKNOWN in anyone of the 5 possible categories; print the 5 YES and NO categories on their report. A person with a YES or NA in all areas should not print. I played around with some IIF statements but nothing seems to work. Upon looking at my SQL, do you have some thoughts?

SELECT Max(tblComplianceLog.RecvdDt) AS MaxOfRecvdDt, Last(tblComplianceLog.Compliant) AS LastOfCompliant, Last(tblComplianceLog.ComplianceDt) AS LastOfComplianceDt, tblComplianceLog.ContractNum, tblComplianceLog.CatID, tblComplianceLog.RelCode, tblCriteria.CriteriaDef, tbl_Category.CatName, tblCriteria.TimeFrame, tbl_Category.CatCode
FROM tblCriteria INNER JOIN (tbl_Category INNER JOIN tblComplianceLog ON tbl_Category.CatCode = tblComplianceLog.CatID) ON tblCriteria.CriteriaCode = tblComplianceLog.CriteriaID
GROUP BY tblComplianceLog.ContractNum, tblComplianceLog.CatID, tblComplianceLog.RelCode, tblCriteria.CriteriaDef, tbl_Category.CatName, tblCriteria.TimeFrame, tbl_Category.CatCode;
 
Id make a single calcualted field tat returns a boolean iof there is a compaint you want to add to your report.

It is then a simple matter to filter for where those are 'true'
 
Got it! Thanks for the advice. I knew there had to be a way but just couldn't get there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top