Ok, I have two new SQL statements, but neither are working. I'm thinking
there are too many arguments (should be 36 in total) as I am working on this
particular one with 5 different field options.
Here is the first SQL: (this is returning all data even after I have
inputted certain criterias on the form.
SELECT TrackCount.DateAdded AS [Date Added], TrackCount.fkDeptID AS Dept,
TrackCount.BizUnitName AS [Business Unit Name], TrackCount.AssignedTo AS
[Assigned To], TrackCount.DocumentType AS [Document Type],
Count(TrackCount.[Bundle#]) AS Bundles, Sum(TrackCount.[CountOfTrack#]) AS
Documents, Sum(TrackCount.Complete) AS Complete, Sum(TrackCount.Incomplete)
AS Incomplete, Sum(TrackCount.[Problem Logged]) AS [Problem Logged],
Sum(TrackCount.Parked) AS Parked, Sum(TrackCount.Paid) AS Paid,
Sum(TrackCount.[FI Review]) AS [FI Review], Sum(TrackCount.Pending) AS
Pending, Sum(TrackCount.Unparked) AS Unparked, Sum(TrackCount.Unpaid) AS
Unpaid, Sum(TrackCount.Revision) AS [Under Review]
FROM TrackCount
GROUP BY TrackCount.DateAdded, TrackCount.fkDeptID, TrackCount.BizUnitName,
TrackCount.AssignedTo, TrackCount.DocumentType
HAVING (((TrackCount.DateAdded) Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype])) OR
(((TrackCount.DateAdded) Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv])) OR
(((TrackCount.DateAdded) Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype])) OR
(((TrackCount.DateAdded) Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit])) OR
(((TrackCount.DateAdded) Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype])) OR
(((TrackCount.DateAdded) Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv])) OR
(((TrackCount.DateAdded) Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype])) OR
(((TrackCount.DateAdded) Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.fkDeptID)=[forms]![reportselection]![dept])) OR
(((TrackCount.DateAdded) Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype])) OR
(((TrackCount.DateAdded) Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv])) OR
(((TrackCount.DateAdded) Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype])) OR
(((TrackCount.DateAdded) Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit])) OR
(((TrackCount.DateAdded) Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype])) OR
(((TrackCount.DateAdded) Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv])) OR
(((TrackCount.DateAdded) Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype])) OR
(((TrackCount.DateAdded) Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto])) OR
(((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype])) OR
(((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv])) OR
(((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype])) OR
(((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit])) OR
(((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype])) OR
(((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv])) OR
(((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype])) OR
(((TrackCount.fkDeptID)=[forms]![reportselection]![dept])) OR
(((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype])) OR
(((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv])) OR
(((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype])) OR
(((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit])) OR
(((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype])) OR
(((TrackCount.AssignedTo)=[forms]![reportselection]![adv])) OR
(((TrackCount.DocumentType)=[forms]![reportselection]![doctype]))
ORDER BY TrackCount.DateAdded, TrackCount.fkDeptID, TrackCount.BizUnitName,
TrackCount.AssignedTo, TrackCount.DocumentType;
Now I also have a second query that I built trying to put the Isnull
function after the field for those fields that should be empty so that it
doesn't take these in terms of criteria. (This query returns nothing to me).
SELECT TrackCount.DateAdded AS [Date Added], TrackCount.fkDeptID AS Dept,
TrackCount.BizUnitName AS [Business Unit Name], TrackCount.AssignedTo AS
[Assigned To], TrackCount.DocumentType AS [Document Type],
Count(TrackCount.[Bundle#]) AS Bundles, Sum(TrackCount.[CountOfTrack#]) AS
Documents, Sum(TrackCount.Complete) AS Complete, Sum(TrackCount.Incomplete)
AS Incomplete, Sum(TrackCount.[Problem Logged]) AS [Problem Logged],
Sum(TrackCount.Parked) AS Parked, Sum(TrackCount.Paid) AS Paid,
Sum(TrackCount.[FI Review]) AS [FI Review], Sum(TrackCount.Pending) AS
Pending, Sum(TrackCount.Unparked) AS Unparked, Sum(TrackCount.Unpaid) AS
Unpaid, Sum(TrackCount.Revision) AS [Under Review]
FROM TrackCount
GROUP BY TrackCount.DateAdded, TrackCount.fkDeptID, TrackCount.BizUnitName,
TrackCount.AssignedTo, TrackCount.DocumentType
HAVING (((TrackCount.DateAdded) Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype])) OR
(((TrackCount.DateAdded) Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
(([forms]![reportselection]![doctype]) Is Null)) OR (((TrackCount.DateAdded)
Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype]) AND
(([forms]![reportselection]![adv]) Is Null)) OR (((TrackCount.DateAdded)
Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
(([forms]![reportselection]![doctype]) Is Null) AND
(([forms]![reportselection]![adv]) Is Null)) OR (((TrackCount.DateAdded)
Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype]) AND
(([forms]![reportselection]![bizunit]) Is Null)) OR (((TrackCount.DateAdded)
Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
(([forms]![reportselection]![doctype]) Is Null) AND
(([forms]![reportselection]![bizunit]) Is Null)) OR (((TrackCount.DateAdded)
Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype]) AND
(([forms]![reportselection]![adv]) Is Null) AND
(([forms]![reportselection]![bizunit]) Is Null)) OR (((TrackCount.DateAdded)
Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
(([forms]![reportselection]![doctype]) Is Null) AND
(([forms]![reportselection]![adv]) Is Null) AND
(([forms]![reportselection]![bizunit]) Is Null)) OR (((TrackCount.DateAdded)
Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype]) AND
(([forms]![reportselection]![dept]) Is Null)) OR (((TrackCount.DateAdded)
Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
(([forms]![reportselection]![doctype]) Is Null) AND
(([forms]![reportselection]![dept]) Is Null)) OR (((TrackCount.DateAdded)
Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype]) AND
(([forms]![reportselection]![adv]) Is Null) AND
(([forms]![reportselection]![dept]) Is Null)) OR (((TrackCount.DateAdded)
Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
(([forms]![reportselection]![doctype]) Is Null) AND
(([forms]![reportselection]![adv]) Is Null) AND
(([forms]![reportselection]![dept]) Is Null)) OR (((TrackCount.DateAdded)
Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype]) AND
(([forms]![reportselection]![bizunit]) Is Null) AND
(([forms]![reportselection]![dept]) Is Null)) OR (((TrackCount.DateAdded)
Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
(([forms]![reportselection]![doctype]) Is Null) AND
(([forms]![reportselection]![bizunit]) Is Null) AND
(([forms]![reportselection]![dept]) Is Null)) OR (((TrackCount.DateAdded)
Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype]) AND
(([forms]![reportselection]![adv]) Is Null) AND
(([forms]![reportselection]![bizunit]) Is Null) AND
(([forms]![reportselection]![dept]) Is Null)) OR (((TrackCount.DateAdded)
Between [forms]![reportselection]![from] And
[forms]![reportselection]![dateto]) AND
(([forms]![reportselection]![doctype]) Is Null) AND
(([forms]![reportselection]![adv]) Is Null) AND
(([forms]![reportselection]![bizunit]) Is Null) AND
(([forms]![reportselection]![dept]) Is Null)) OR
(((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype]) AND
(([forms]![reportselection]![from]) Is Null) AND
(([forms]![reportselection]![dateto]) Is Null)) OR
(((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
(([forms]![reportselection]![doctype]) Is Null) AND
(([forms]![reportselection]![from]) Is Null) AND
(([forms]![reportselection]![dateto]) Is Null)) OR
(((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype]) AND
(([forms]![reportselection]![adv]) Is Null) AND
(([forms]![reportselection]![from]) Is Null) AND
(([forms]![reportselection]![dateto]) Is Null)) OR
(((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
(([forms]![reportselection]![doctype]) Is Null) AND
(([forms]![reportselection]![adv]) Is Null) AND
(([forms]![reportselection]![from]) Is Null) AND
(([forms]![reportselection]![dateto]) Is Null)) OR
(((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype]) AND
(([forms]![reportselection]![bizunit]) Is Null) AND
(([forms]![reportselection]![from]) Is Null) AND
(([forms]![reportselection]![dateto]) Is Null)) OR
(((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
(([forms]![reportselection]![doctype]) Is Null) AND
(([forms]![reportselection]![bizunit]) Is Null) AND
(([forms]![reportselection]![from]) Is Null) AND
(([forms]![reportselection]![dateto]) Is Null)) OR
(((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype]) AND
(([forms]![reportselection]![adv]) Is Null) AND
(([forms]![reportselection]![bizunit]) Is Null) AND
(([forms]![reportselection]![from]) Is Null) AND
(([forms]![reportselection]![dateto]) Is Null)) OR
(((TrackCount.fkDeptID)=[forms]![reportselection]![dept]) AND
(([forms]![reportselection]![doctype]) Is Null) AND
(([forms]![reportselection]![adv]) Is Null) AND
(([forms]![reportselection]![bizunit]) Is Null) AND
(([forms]![reportselection]![from]) Is Null) AND
(([forms]![reportselection]![dateto]) Is Null)) OR
(((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype]) AND
(([forms]![reportselection]![dept]) Is Null) AND
(([forms]![reportselection]![from]) Is Null) AND
(([forms]![reportselection]![dateto]) Is Null)) OR
(((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
(([forms]![reportselection]![doctype]) Is Null) AND
(([forms]![reportselection]![dept]) Is Null) AND
(([forms]![reportselection]![from]) Is Null) AND
(([forms]![reportselection]![dateto]) Is Null)) OR
(((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype]) AND
(([forms]![reportselection]![adv]) Is Null) AND
(([forms]![reportselection]![dept]) Is Null) AND
(([forms]![reportselection]![from]) Is Null) AND
(([forms]![reportselection]![dateto]) Is Null)) OR
(((TrackCount.BizUnitName)=[forms]![reportselection]![bizunit]) AND
(([forms]![reportselection]![doctype]) Is Null) AND
(([forms]![reportselection]![adv]) Is Null) AND
(([forms]![reportselection]![dept]) Is Null) AND
(([forms]![reportselection]![from]) Is Null) AND
(([forms]![reportselection]![dateto]) Is Null)) OR
(((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
((TrackCount.DocumentType)=[forms]![reportselection]![doctype]) AND
(([forms]![reportselection]![bizunit]) Is Null) AND
(([forms]![reportselection]![dept]) Is Null) AND
(([forms]![reportselection]![from]) Is Null) AND
(([forms]![reportselection]![dateto]) Is Null)) OR
(((TrackCount.AssignedTo)=[forms]![reportselection]![adv]) AND
(([forms]![reportselection]![doctype]) Is Null) AND
(([forms]![reportselection]![bizunit]) Is Null) AND
(([forms]![reportselection]![dept]) Is Null) AND
(([forms]![reportselection]![from]) Is Null) AND
(([forms]![reportselection]![dateto]) Is Null)) OR
(((TrackCount.DocumentType)=[forms]![reportselection]![doctype]) AND
(([forms]![reportselection]![adv]) Is Null) AND
(([forms]![reportselection]![bizunit]) Is Null) AND
(([forms]![reportselection]![dept]) Is Null) AND
(([forms]![reportselection]![from]) Is Null) AND
(([forms]![reportselection]![dateto]) Is Null)) OR
((([forms]![reportselection]![doctype]) Is Null) AND
(([forms]![reportselection]![adv]) Is Null) AND
(([forms]![reportselection]![bizunit]) Is Null) AND
(([forms]![reportselection]![dept]) Is Null) AND
(([forms]![reportselection]![from]) Is Null) AND
(([forms]![reportselection]![dateto]) Is Null))
ORDER BY TrackCount.DateAdded, TrackCount.fkDeptID, TrackCount.BizUnitName,
TrackCount.AssignedTo, TrackCount.DocumentType;
Is there anything I am missing?
I'm thinking the multiple identical queries idea will be the only thing to
work.
Your thoughts are much appreciated.