Crosstab Query Help (1 Viewer)

spudracer

Here and there
Local time
Today, 14:28
Joined
Jul 1, 2008
Messages
199
I'm trying to create a crosstab query that relies on dynamic column headings (user can change which columns are visible).

How I want it to look:
Present
Admin1
Operations2

How it's showing up:
LeavePresent
0
Admin1
Operations2

While I do want all of the columns to show regardless if they have any value other than 0 in them, I don't want the blank row.

I have the crosstab setup like this:
Code:
TRANSFORM Count(qryPersActive.MusterStatus) AS CountOfMusterStatus
SELECT qryPersActive.Dept
FROM tblMusterStatus LEFT JOIN qryPersActive ON tblMusterStatus.Status = qryPersActive.MusterStatus
WHERE (((tblMusterStatus.Use)=True))
GROUP BY qryPersActive.Dept
PIVOT tblMusterStatus.Status;
 

theDBguy

I’m here to help
Staff member
Local time
Today, 11:28
Joined
Oct 29, 2018
Messages
21,454
Hi. Try adding one more criteria.
Code:
 WHERE (((tblMusterStatus.Use)=True)) AND Dept Is Not Null
Hope that helps...
 

spudracer

Here and there
Local time
Today, 14:28
Joined
Jul 1, 2008
Messages
199
Hi. Try adding one more criteria.
Code:
 WHERE (((tblMusterStatus.Use)=True)) AND Dept Is Not Null
Hope that helps...

That takes care of the Null row, but it drops the columns that are also null.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 11:28
Joined
Oct 29, 2018
Messages
21,454
That takes care of the Null row, but it drops the columns that are also null.
Hmm, not sure I follow. Your columns are based on Status, so why would filtering out null Dept would affect it? Can you post a sample db with test data?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:28
Joined
May 7, 2009
Messages
19,229
alternative to Create another Query from your Crosstab
with Criteria: Dept Not Is Null
 

Users who are viewing this thread

Top Bottom