Default value in crosstab query

B

Bart Tse

Hello all,

I have a crosstab query (SQL below) that will display yes/no values fine
except when there is no data for that particular spot(Null I'm guessing). Is
there a way to default the cells to "NO"? Maybe another function besides Max
or something I can give Max?
Thanks
TRANSFORM Max(IIf([Attended],"Yes","No")) AS TheValue
SELECT [Six Sigma Focus Group Attendence].Name AS ID, [Six Sigma Focus Group
Attendence].[Company Represented]
FROM [Six Sigma Focus Group Attendence]
GROUP BY [Six Sigma Focus Group Attendence].Name, [Six Sigma Focus Group
Attendence].[Company Represented]
PIVOT [Six Sigma Focus Group Attendence].[Meeting Date];
 
D

Dale Fye

Bart,

You might want to try using the NZ function. Something like:

TRANSFORM Max(IIf(NZ([Attended], False),"Yes","No")) AS TheValue
SELECT [Six Sigma Focus Group Attendence].Name AS ID, [Six Sigma Focus Group
Attendence].[Company Represented]
FROM [Six Sigma Focus Group Attendence]
GROUP BY [Six Sigma Focus Group Attendence].Name, [Six Sigma Focus Group
Attendence].[Company Represented]
PIVOT [Six Sigma Focus Group Attendence].[Meeting Date];

Dale
 
A

Allen Browne

Try adding Nz() around the field in the TRANSFORM clause.

I'm not sure I understand what this query is supposed to do, but try:
TRANSFORM Nz(Max(IIf([Attended],"Yes","No")), "No") AS TheValue
 
B

Bart Tse

Thanks so much, that worked great

Allen Browne said:
Try adding Nz() around the field in the TRANSFORM clause.

I'm not sure I understand what this query is supposed to do, but try:
TRANSFORM Nz(Max(IIf([Attended],"Yes","No")), "No") AS TheValue

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Bart Tse said:
I have a crosstab query (SQL below) that will display yes/no values fine
except when there is no data for that particular spot(Null I'm guessing).
Is
there a way to default the cells to "NO"? Maybe another function besides
Max
or something I can give Max?
Thanks
TRANSFORM Max(IIf([Attended],"Yes","No")) AS TheValue
SELECT [Six Sigma Focus Group Attendence].Name AS ID, [Six Sigma Focus
Group
Attendence].[Company Represented]
FROM [Six Sigma Focus Group Attendence]
GROUP BY [Six Sigma Focus Group Attendence].Name, [Six Sigma Focus Group
Attendence].[Company Represented]
PIVOT [Six Sigma Focus Group Attendence].[Meeting Date];
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top