Can someone please help me with the query below. I am trying to exclude the records that have "Exclusion" on a field and the query is not excluding them. Not sure what is the problem with the query. Guidance please.
SELECT tblDNSaudit.DNSName, tblDNSaudit.IP, tblAuditIdDescription.Category, tblDNSaudit.InitialDate AS DateIdentified, tblDNSaudit.AppearDate AS DateLastReported, tblDNSaudit.AuditId, tblAuditIdDescription.Description, tblAuditIdDescription.FixInformation, tblDNSaudit.ExclusionCategory, IIf([Category]="Category III",[DateIdentified]+180,IIf([Category]="Category II",[DateIdentified]+60,IIf([Category]="Category I",[DateIdentified]+25,"F"))) AS CatDueDate
FROM tblAuditIdDescription INNER JOIN tblDNSaudit ON tblAuditIdDescription.AuditID = tblDNSaudit.AuditId
WHERE (((tblAuditIdDescription.Category)<>"Category IV") AND ((tblDNSaudit.AppearDate)=(SELECT Max(tblDNSaudit.AppearDate) AS MaxOfAppearDate
FROM tblDNSaudit)) AND ((tblDNSaudit.ExclusionCategory)<>"Exclusion"))
ORDER BY tblDNSaudit.DNSName, tblAuditIdDescription.Category;
Thank you, Luis
SELECT tblDNSaudit.DNSName, tblDNSaudit.IP, tblAuditIdDescription.Category, tblDNSaudit.InitialDate AS DateIdentified, tblDNSaudit.AppearDate AS DateLastReported, tblDNSaudit.AuditId, tblAuditIdDescription.Description, tblAuditIdDescription.FixInformation, tblDNSaudit.ExclusionCategory, IIf([Category]="Category III",[DateIdentified]+180,IIf([Category]="Category II",[DateIdentified]+60,IIf([Category]="Category I",[DateIdentified]+25,"F"))) AS CatDueDate
FROM tblAuditIdDescription INNER JOIN tblDNSaudit ON tblAuditIdDescription.AuditID = tblDNSaudit.AuditId
WHERE (((tblAuditIdDescription.Category)<>"Category IV") AND ((tblDNSaudit.AppearDate)=(SELECT Max(tblDNSaudit.AppearDate) AS MaxOfAppearDate
FROM tblDNSaudit)) AND ((tblDNSaudit.ExclusionCategory)<>"Exclusion"))
ORDER BY tblDNSaudit.DNSName, tblAuditIdDescription.Category;
Thank you, Luis