A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Make Crosstab Query Display All Event Types even if Event Type not chosen by any participant



 
 
Thread Tools Display Modes
  #1  
Old February 12th, 2007, 04:24 AM posted to microsoft.public.access.queries
Kay
external usenet poster
 
Posts: 9
Default Make Crosstab Query Display All Event Types even if Event Type not chosen by any participant

Hello - I have my database all worked out and I am totally
excited....just one more thing. My crosstab query sums up the number
of event types (eventtypeID) by month (activitydate) - good. However,
if one of the event types is not chosen for any of the participants,
then it is not listed on the query output table. I want all of the
options that I have as events to be listed on the query table even if
its not chosen by anyone (with the event's monthly counts showing a 0
of course).

Heres my code. Let me know if you need more info. I've tried to find
info on the net and put that 'or is null' next to the criteria field
in the crosstab under EventTypeID...didnt work, all the data in my
query disappeared in the table view.


CROSSTAB QUERY
TRANSFORM Nz(Count([CountOfEventTypeID]),0) AS Expr1
SELECT [Part Count].EventTypeID, Count([Part
Count].CountOfEventTypeID) AS [Total Of CountOfEventTypeID]
FROM [Part Count]
GROUP BY [Part Count].EventTypeID
PIVOT Format([ActivityDate],"mmm") In
("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug"," Sep","Oct","Nov","Dec");

WHICH IS BASED OFF THIS QUERY (Part Count)
SELECT [Activity Tracker].EventTypeID, Count([Activity
Tracker].ActivityTrackerID) AS CountOfActivityTrackerID, [Activity
Tracker].ActivityDate, Count([Activity Tracker].EventTypeID) AS
CountOfEventTypeID
FROM [Activity Tracker]
GROUP BY [Activity Tracker].EventTypeID, [Activity
Tracker].ActivityDate;


Thank you,
K

  #2  
Old February 12th, 2007, 05:56 AM posted to microsoft.public.access.queries
tina
external usenet poster
 
Posts: 1,997
Default Make Crosstab Query Display All Event Types even if Event Type not chosen by any participant

try adding the EventType table to the base query, with a LEFT JOIN *from*
the EventType table *to* the ActivityTracker table, on their common fields.
to get a LEFT JOIN, set the link to "show all records from the EventType
table, and only matching records from the ActivityTracker table". use the
EventTypeID field from the EventType table, rather than the ActivityTracker
table, in the query output.

hth


"Kay" wrote in message
oups.com...
Hello - I have my database all worked out and I am totally
excited....just one more thing. My crosstab query sums up the number
of event types (eventtypeID) by month (activitydate) - good. However,
if one of the event types is not chosen for any of the participants,
then it is not listed on the query output table. I want all of the
options that I have as events to be listed on the query table even if
its not chosen by anyone (with the event's monthly counts showing a 0
of course).

Heres my code. Let me know if you need more info. I've tried to find
info on the net and put that 'or is null' next to the criteria field
in the crosstab under EventTypeID...didnt work, all the data in my
query disappeared in the table view.


CROSSTAB QUERY
TRANSFORM Nz(Count([CountOfEventTypeID]),0) AS Expr1
SELECT [Part Count].EventTypeID, Count([Part
Count].CountOfEventTypeID) AS [Total Of CountOfEventTypeID]
FROM [Part Count]
GROUP BY [Part Count].EventTypeID
PIVOT Format([ActivityDate],"mmm") In
("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug"," Sep","Oct","Nov","Dec");

WHICH IS BASED OFF THIS QUERY (Part Count)
SELECT [Activity Tracker].EventTypeID, Count([Activity
Tracker].ActivityTrackerID) AS CountOfActivityTrackerID, [Activity
Tracker].ActivityDate, Count([Activity Tracker].EventTypeID) AS
CountOfEventTypeID
FROM [Activity Tracker]
GROUP BY [Activity Tracker].EventTypeID, [Activity
Tracker].ActivityDate;


Thank you,
K



  #3  
Old February 13th, 2007, 12:26 AM posted to microsoft.public.access.queries
Kay
external usenet poster
 
Posts: 9
Default Make Crosstab Query Display All Event Types even if Event Type not chosen by any participant

didnt work...showed the same information as before. any other ideas?

On Feb 11, 11:56 pm, "tina" wrote:
try adding the EventType table to the base query, with a LEFT JOIN *from*
the EventType table *to* the ActivityTracker table, on their common fields.
to get a LEFT JOIN, set the link to "show all records from the EventType
table, and only matching records from the ActivityTracker table". use the
EventTypeID field from the EventType table, rather than the ActivityTracker
table, in the query output.

hth

"Kay" wrote in message

oups.com...

Hello - I have my database all worked out and I am totally
excited....just one more thing. My crosstab query sums up the number
of event types (eventtypeID) by month (activitydate) - good. However,
if one of the event types is not chosen for any of the participants,
then it is not listed on the query output table. I want all of the
options that I have as events to be listed on the query table even if
its not chosen by anyone (with the event's monthly counts showing a 0
of course).


Heres my code. Let me know if you need more info. I've tried to find
info on the net and put that 'or is null' next to the criteria field
in the crosstab under EventTypeID...didnt work, all the data in my
query disappeared in the table view.


CROSSTAB QUERY
TRANSFORM Nz(Count([CountOfEventTypeID]),0) AS Expr1
SELECT [Part Count].EventTypeID, Count([Part
Count].CountOfEventTypeID) AS [Total Of CountOfEventTypeID]
FROM [Part Count]
GROUP BY [Part Count].EventTypeID
PIVOT Format([ActivityDate],"mmm") In
("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug"," Sep","Oct","Nov","Dec");


WHICH IS BASED OFF THIS QUERY (Part Count)
SELECT [Activity Tracker].EventTypeID, Count([Activity
Tracker].ActivityTrackerID) AS CountOfActivityTrackerID, [Activity
Tracker].ActivityDate, Count([Activity Tracker].EventTypeID) AS
CountOfEventTypeID
FROM [Activity Tracker]
GROUP BY [Activity Tracker].EventTypeID, [Activity
Tracker].ActivityDate;


Thank you,
K



  #4  
Old February 13th, 2007, 04:10 AM posted to microsoft.public.access.queries
tina
external usenet poster
 
Posts: 1,997
Default Make Crosstab Query Display All Event Types even if Event Type not chosen by any participant

no, that was it, sorry.


"Kay" wrote in message
ps.com...
didnt work...showed the same information as before. any other ideas?

On Feb 11, 11:56 pm, "tina" wrote:
try adding the EventType table to the base query, with a LEFT JOIN

*from*
the EventType table *to* the ActivityTracker table, on their common

fields.
to get a LEFT JOIN, set the link to "show all records from the EventType
table, and only matching records from the ActivityTracker table". use

the
EventTypeID field from the EventType table, rather than the

ActivityTracker
table, in the query output.

hth

"Kay" wrote in message

oups.com...

Hello - I have my database all worked out and I am totally
excited....just one more thing. My crosstab query sums up the number
of event types (eventtypeID) by month (activitydate) - good. However,
if one of the event types is not chosen for any of the participants,
then it is not listed on the query output table. I want all of the
options that I have as events to be listed on the query table even if
its not chosen by anyone (with the event's monthly counts showing a 0
of course).


Heres my code. Let me know if you need more info. I've tried to find
info on the net and put that 'or is null' next to the criteria field
in the crosstab under EventTypeID...didnt work, all the data in my
query disappeared in the table view.


CROSSTAB QUERY
TRANSFORM Nz(Count([CountOfEventTypeID]),0) AS Expr1
SELECT [Part Count].EventTypeID, Count([Part
Count].CountOfEventTypeID) AS [Total Of CountOfEventTypeID]
FROM [Part Count]
GROUP BY [Part Count].EventTypeID
PIVOT Format([ActivityDate],"mmm") In

("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug"," Sep","Oct","Nov","Dec");

WHICH IS BASED OFF THIS QUERY (Part Count)
SELECT [Activity Tracker].EventTypeID, Count([Activity
Tracker].ActivityTrackerID) AS CountOfActivityTrackerID, [Activity
Tracker].ActivityDate, Count([Activity Tracker].EventTypeID) AS
CountOfEventTypeID
FROM [Activity Tracker]
GROUP BY [Activity Tracker].EventTypeID, [Activity
Tracker].ActivityDate;


Thank you,
K





  #5  
Old February 13th, 2007, 09:26 AM posted to microsoft.public.access.queries
Gary Walter
external usenet poster
 
Posts: 613
Default Make Crosstab Query Display All Event Types even if Event Type not chosen by any participant

Please show SQL that "didn't work"...

I wonder if you did not "use" EventTypeID from
"inner table," i.e., [Activity Tracker], instead of
EventTypeID from "outer table" (EventType table).

just a guess (if your table named "EventType")...

TRANSFORM Nz(Count(E.EventTypeID),0) AS MnthCnt
SELECT
E.EventTypeID,
Count(E.EventTypeID) AS TotCntForEventType,
FROM
EventType As E
LEFT JOIN
[Activity Tracker] As A
ON
E.EventTypeID = A.EventTypeID
GROUP BY
E.EventTypeID
PIVOT Format(A.[ActivityDate],"mmm") In
("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug"," Sep","Oct","Nov","Dec");

Do you see how you might get "same info"
if you had used "A.EventTypeID" instead of
"E.EventTypeID?"

SELECT
E.EventTypeID,
A.EventTypeID,
Count(E.EventTypeID) As CntE,
Count(A.EventTypeID) As CntA
FROM
EventType As E
LEFT JOIN
[Activity Tracker] As A
ON
E.EventTypeID = A.EventTypeID
GROUP BY
E.EventTypeID,
A.EventTypeID;

Of course I may have completely misunderstood...

"Kay" wrote:
didnt work...showed the same information as before. any other ideas?

On Feb 11, 11:56 pm, "tina" wrote:
try adding the EventType table to the base query, with a LEFT JOIN *from*
the EventType table *to* the ActivityTracker table, on their common
fields.
to get a LEFT JOIN, set the link to "show all records from the EventType
table, and only matching records from the ActivityTracker table". use the
EventTypeID field from the EventType table, rather than the
ActivityTracker
table, in the query output.

hth

"Kay" wrote in message

oups.com...

Hello - I have my database all worked out and I am totally
excited....just one more thing. My crosstab query sums up the number
of event types (eventtypeID) by month (activitydate) - good. However,
if one of the event types is not chosen for any of the participants,
then it is not listed on the query output table. I want all of the
options that I have as events to be listed on the query table even if
its not chosen by anyone (with the event's monthly counts showing a 0
of course).


Heres my code. Let me know if you need more info. I've tried to find
info on the net and put that 'or is null' next to the criteria field
in the crosstab under EventTypeID...didnt work, all the data in my
query disappeared in the table view.


CROSSTAB QUERY
TRANSFORM Nz(Count([CountOfEventTypeID]),0) AS Expr1
SELECT [Part Count].EventTypeID, Count([Part
Count].CountOfEventTypeID) AS [Total Of CountOfEventTypeID]
FROM [Part Count]
GROUP BY [Part Count].EventTypeID
PIVOT Format([ActivityDate],"mmm") In
("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug"," Sep","Oct","Nov","Dec");


WHICH IS BASED OFF THIS QUERY (Part Count)
SELECT [Activity Tracker].EventTypeID, Count([Activity
Tracker].ActivityTrackerID) AS CountOfActivityTrackerID, [Activity
Tracker].ActivityDate, Count([Activity Tracker].EventTypeID) AS
CountOfEventTypeID
FROM [Activity Tracker]
GROUP BY [Activity Tracker].EventTypeID, [Activity
Tracker].ActivityDate;


Thank you,
K





 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:29 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.