How to Disply Zero Value in a Crosstab Query

magnumeng
NewLounger
Posts: 14
Joined: 07 Feb 2011, 14:28

How to Disply Zero Value in a Crosstab Query

Post by magnumeng »

Hello all,

I am trying to build a data base for work and ran into a problem.

I have 10 different offices that have some of the same billets but not all that work in them.

Example:
Officeclerksmanagers
accounting22
shipping20
admin22
receiving10
I have to display all the Offices on my report. Currently when I build my report if any billet has a ZERO value it will not display the office at all. How do I get my Query to display ZERO for the billets?

Chad
Last edited by HansV on 02 Mar 2011, 15:23, edited 1 time in total.
Reason: to present data in table format

User avatar
HansV
Administrator
Posts: 78790
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How to Disply Zero Value in a Crosstab Query

Post by HansV »

Welcome to Eileen's Lounge!

Create a new query in design view.
Add the table listing the (unique) offices to the query and also your crosstab query.
Join them on the Office field by dragging the field from the offices table to the corresponding field in the crosstab query.
Double-click the join line and select the option to include ALL records from the offices table and only related records form the crosstab query, then click OK.
Add the Office field from the offices table to the query grid.
Add a calculated field like this, substituting the correct names:

Clerks: Val(Nz([crosstabqueryname].[clerks],0))

Do the same for the managers field:

Managers: Val(Nz([crosstabqueryname].[managers],0))

This query should list all offices, with 0s for those that don't have clerks or managers.
Best wishes,
Hans

magnumeng
NewLounger
Posts: 14
Joined: 07 Feb 2011, 14:28

Re: How to Disply Zero Value in a Crosstab Query

Post by magnumeng »

HansV,

Thank you for your quick reply. But I am sure i am not doing it right. I put in the formula that you recommended but it still does not include ZERO Values...

TblMCCRoster-Contains all offices
qryfy11TOMO-contains all billets
qryMONumbers - Contains all the people filling TOMO billets
qryfy11TOME-contains all billets
qryMENumbers - Contains all the people filling TOME billets
qryfy11TONO-contains all billets
qryMONumbers - Contains all the people filling TONO billets
qryfy11TONE-contains all billets
qryMONumbers - Contains all the people filling TONE billets
qryCIVNumbers - Contains all the people filling Civ Billets (have not built the query for available billets)

all Officers have the first four(Qryfy11MOTO, qryMONumbers, Qryfy11METO, qryMENumbers).
The rest of the queries do not have someone working in one or more of the Offices. Which is making my report and/or query not show all my offices.

I am working on scrubbing database down so I can attach it here for better help.

Chad
You do not have the required permissions to view the files attached to this post.
Last edited by magnumeng on 03 Mar 2011, 14:23, edited 1 time in total.

magnumeng
NewLounger
Posts: 14
Joined: 07 Feb 2011, 14:28

Re: How to Disply Zero Value in a Crosstab Query

Post by magnumeng »

Here is a scrubbed down version of what I am working with.

HansV,

I tried using the formula that you provided with no luck in QRYROLLUP.


Chad
Darn Computer are only as smart as the person hitting the keys. Man am I hurting...
You do not have the required permissions to view the files attached to this post.

JohnH
3StarLounger
Posts: 287
Joined: 09 Mar 2010, 23:16
Location: Canberra Australia

Re: How to Disply Zero Value in a Crosstab Query

Post by JohnH »

In the Design of qryRollup, double click each of the lines joining tblMCCRoster with each of the other queries, and change the Join type as shown below.
Repeat for all the joins.
JoinType.gif
You do not have the required permissions to view the files attached to this post.
Regards

John

magnumeng
NewLounger
Posts: 14
Joined: 07 Feb 2011, 14:28

Re: How to Disply Zero Value in a Crosstab Query

Post by magnumeng »

HansV and JohnH,

Thank you very much... JohnH you solution solved my problem that I has hunted me for months.

Chad
Darn Computer are only as smart as the person hitting the keys. Man am I hurting...

JohnH
3StarLounger
Posts: 287
Joined: 09 Mar 2010, 23:16
Location: Canberra Australia

Re: How to Disply Zero Value in a Crosstab Query

Post by JohnH »

HansV wrote: Double-click the join line and select the option to include ALL records from the offices table and only related records form the crosstab query, then click OK.
Hans had actually told you to change the join type in his post as well.
Regards

John