crosstab query error

P

Patricia Lynch

have this crosstab query in Access 2003

TRANSFORM Count(TblMo1A.NewIncidentID) AS CountOfNewIncidentID
SELECT TblMo1A.TypeDescription
FROM TblMo1A
GROUP BY TblMo1A.TypeDescription
PIVOT TblMo1A.IncidentYear In ("Yr1","Yr2");

Am trying to set the 2 column headings to "Yr1" and "Yr2" by changing in
properties- Column Headings.

When I run query, I get this message- "Type mismatch in criteria expression"
If I take out the column headings property change, the query runs fine.

Is there an error in Access 2003 re: chaning column headings? or am I doing
something wrong?

thanks for help
 
J

John Spencer

What is actually in IncidentYear? I'm going to bet that it isn't "Yr1" or
"Yr2". It is probably a number, such as 2007.

So if the values were 2008 and 2007, you could use an expression like the
following

Pivot "Yr" & (IncidentYear - 2006) IN ("Yr1","Yr2")

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

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