Data type mismatch with Totals Query

C

CuriousMark

I am trying to build a totals query (or crosstab query) using information
from another query. The first query (qryDetN) is based on data from several
tables, and uses a "Switch" statement to determine a value for the field
[WhatN] based on values in the fields [StationNum], [BxSide] and [Side]:

WhatN:
Switch([StationNum]=7,"N2",[StationNum]<12,(IIf([BxSide]=[Side],"N2","N3")),[StationNum]<16,"N1",[StationNum]=16,"Adr",[StationNum]=17,"Ma")

The output is either "N1", "N2", "N3", "Adr", or "Ma". This produces what I
want.

I can create a new query based on this one using just the ID field (US_ID)
and [WhatN], but when I try to convert it into a totals query I get a data
type mismatch.

The text of the query I am trying to create is:

SELECT Count([qryDetN].US_ID) AS CountOfUS_ID, [qryDetN].WhatN
FROM [qryDetN]
GROUP BY [qryDetN].WhatN;

Thanks for your help in advance.
 

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