Hi y'all. I'm trying to filter a query using multiple parameters, but I keep getting the entire unfiltered query. I want to be able to input some parameters and skip others by leaving them blank but the two potential methods I've been able to come up with result in either all results being shown or nothing being shown when I leave a parameter blank. Any ideas?
Code:
SELECT I.IID, I.IncidentDate, D.Shift, I.EID, EI.EmployeeName, D.DepartmentName, D.Supervisor, C.ReportCategory, I.IncidentDescription
FROM ((I INNER JOIN C ON I.[CID] = C.[CID]) INNER JOIN D ON I.[DID] = D.[DID]) INNER JOIN EI ON I.[EID] = EI.[EID]
GROUP BY I.IID, I.IncidentDate, D.Shift, I.EID, EI.EmployeeName, D.DepartmentName, D.Supervisor, C.ReportCategory, I.IncidentDescription
HAVING ((((I.IncidentDate)=[When was the report filed?],"*") AND ((D.Shift)=[Which Shift?] OR "*") AND ((I.EID)=[Target Employee ID #] OR "*") AND ((EI.EmployeeName)=[Employee's Name? (First and Last)] OR "*") AND ((D.DepartmentName)=[Which Department?] OR "*") AND ((C.ReportCategory)=[Which Category?] OR "*"));